Example #1
0
 public List <Customers> GetAll()
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         return(northwind.Customers.ToList());
     }
 }
Example #2
0
 public List <Products> GetAll()
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         return(northwind.Products.ToList());
     }
 }
Example #3
0
 public Shippers GetOne(int id)
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         return(northwind.Shippers.FirstOrDefault(s => s.ShipperID == id));
     }
 }
 public List <Categories> GetAll()
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         return(northwind.Categories.ToList());
     }
 }
Example #5
0
 public Categories GetOne(int id)
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         return(northwind.Categories.FirstOrDefault(s => s.CategoryID == id));
     }
 }
Example #6
0
 public void AddShipper(Shippers shipper)
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         northwind.Shippers.Add(shipper);
         northwind.SaveChanges();
     }
 }
Example #7
0
 public List <Shippers> GetShippers()
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         List <Shippers> listShippers = northwind.Shippers.ToList();
         return(listShippers);
     }
 }
Example #8
0
 public void AddCategorie(Categories shipper)
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         northwind.Categories.Add(shipper);
         northwind.SaveChanges();
     }
 }
Example #9
0
 public List <Categories> GetCategories()
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         List <Categories> listCategories = northwind.Categories.ToList();
         return(listCategories);
     }
 }
Example #10
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();
     }
 }
Example #11
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();
     }
 }
Example #12
0
 public void EditarCategorie(Categories categ)
 {
     using (NorthwindModel northwind = new NorthwindModel())
     {
         DeleteCategorie(categ.CategoryID);
         AddCategorie(categ);
         northwind.SaveChanges();
     }
 }
Example #13
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();
     }
 }