Пример #1
0
        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));
        }
Пример #2
0
        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));
        }