>> Here i have two tables one is Emp and second one is Contact table
I went to retrive data from both table than i create one collection using List<> and create temp class...is name as empdetail..
[OperationContract]
public List<Empdetail> getpiza(int id)
{
var s = (from a in obj.Emp
join b in obj.contacts on a.id equals b.Emp.id
where a.id == id
select new Empdetail
{
name= a.name,
city= a.city,
email=b.email
});
return s.ToList();
}
[DataContract]
public class Empdetail
{
[DataMember]
public string name { set; get; }
[DataMember]
public string city { set; get; }
[DataMember]
public string email { set; get; }
}
No comments:
Post a Comment