public static ShopDTO Add(ShopDTO shop) { Shop s = ShopConverter.DTOToDAL(shop); using (GetCoffeeDBEntities db = new GetCoffeeDBEntities()) { db.Shops.Add(s); db.SaveChanges(); } return(ShopConverter.DALToDTO(s)); }
public static ShopDTO Entry(ShopDTO shop) { Shop shopDal = ShopConverter.DTOToDAL(shop); using (GetCoffeeDBEntities db = new GetCoffeeDBEntities()) { db.Entry(shopDal).State = EntityState.Modified; db.SaveChanges(); } return(ShopConverter.DALToDTO(shopDal)); }