public IEnumerable <SUPPLIER> GetAllSuppliers() { using (PODbEntities1 context = new PODbEntities1()) { return(context.SUPPLIERs.ToList()); } }
public void UpdateSupplier(SUPPLIER item) { using (PODbEntities1 context = new PODbEntities1()) { context.Entry(item).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void DeleteSupplier(string id) { using (PODbEntities1 context = new PODbEntities1()) { context.SUPPLIERs.Remove( context.SUPPLIERs.Where(e => e.SUPLNO == id).FirstOrDefault()); context.SaveChanges(); } }
public void AddSupplier(SUPPLIER item) { try { using (PODbEntities1 context = new PODbEntities1()) { context.SUPPLIERs.Add(item); context.SaveChanges(); } } catch (Exception e) { throw new Exception(e.Message.ToString()); } }
public SUPPLIER GetSupplier(string id) { using (PODbEntities1 context = new PODbEntities1()) { var ProductSupplier = (from s in context.SUPPLIERs where s.SUPLNO.Equals(id) select s).FirstOrDefault(); if (ProductSupplier != null) { return(ProductSupplier); } else { throw new Exception("Invalid Supplier Number"); } } }