public void AddShipper(Shippers shipper) { using (NorthwindModel northwind = new NorthwindModel()) { northwind.Shippers.Add(shipper); northwind.SaveChanges(); } }
public void AddCategorie(Categories shipper) { using (NorthwindModel northwind = new NorthwindModel()) { northwind.Categories.Add(shipper); northwind.SaveChanges(); } }
public void DeleteShipper(int id) { using (NorthwindModel northwind = new NorthwindModel()) { Shippers shipDelete = northwind.Shippers.FirstOrDefault(s => s.ShipperID == id); northwind.Shippers.Remove(shipDelete); northwind.SaveChanges(); } }
public void DeleteCategorie(int id) { using (NorthwindModel northwind = new NorthwindModel()) { Categories shipDelete = northwind.Categories.FirstOrDefault(s => s.CategoryID == id); northwind.Categories.Remove(shipDelete); northwind.SaveChanges(); } }
public void EditarCategorie(Categories categ) { using (NorthwindModel northwind = new NorthwindModel()) { DeleteCategorie(categ.CategoryID); AddCategorie(categ); northwind.SaveChanges(); } }
public void EditarShipper(Shippers shipper) { using (NorthwindModel northwind = new NorthwindModel()) { Shippers shipDelete = northwind.Shippers.FirstOrDefault(s => s.ShipperID == shipper.ShipperID); northwind.Shippers.Remove(shipDelete); northwind.Shippers.Add(shipper); northwind.SaveChanges(); } }