示例#1
0
 public void AddShipper(Shippers shipper)
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         northwind.Shippers.Add(shipper);
         northwind.SaveChanges();
     }
 }
示例#2
0
 public void AddCategorie(Categories shipper)
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         northwind.Categories.Add(shipper);
         northwind.SaveChanges();
     }
 }
示例#3
0
 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();
     }
 }
示例#4
0
 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();
     }
 }
示例#5
0
 public void EditarCategorie(Categories categ)
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         DeleteCategorie(categ.CategoryID);
         AddCategorie(categ);
         northwind.SaveChanges();
     }
 }
示例#6
0
 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();
     }
 }