public Supplier getSupplierByName(string name) { supplier s = ctx.suppliers.FirstOrDefault(x => x.name == name); Supplier supp = new Supplier(); supp.SupplierId = s.supplierId; supp.SupplierName = s.name; supp.ContactName = s.contactName; return supp; }
public List<Supplier> getAllSupplier() { var su = from ss in ctx.suppliers select ss; List<Supplier> slist = new List<Supplier>(); foreach(supplier supp in su.ToList()) { Supplier s = new Supplier(); s.SupplierId = supp.supplierId; s.SupplierName = supp.name; s.ContactName = supp.contactName; slist.Add(s); } return slist; }