Hi!
I found this way of create and populate object and, at the same time, retrieve data using LINQ.
public CustomerModel find(string id)
{
DataClasses1DataContext lObjDC = new DataClasses1DataContext();
var varCustomerModel = lObjDC.Customers.Where(x => x.CustomerID == id).Select(p => new CustomerModel(p.CustomerID, p.CompanyName)).Single();
return varCustomerModel;
}
Nenhum comentário:
Postar um comentário