Exemple #1
0
 public void UpdateShop(ShopEntity shop)
 {
     using (ShopEntityContext db = new ShopEntityContext())
     {
         db.Entry(shop).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shop"></param>
 /// <returns>Id магазина в БД</returns>
 public int InsertShop(ShopEntity shop)
 {
     //TODO: сделать проверку на существующий элемент. В этом случае делать Update
     using (ShopEntityContext db = new ShopEntityContext())
     {
         ShopEntity insertedShop = db.Shops.Add(shop);
         db.SaveChanges();
         return(insertedShop.Id);
     }
 }