Пример #1
0
        public void CreatePie(Pie pie)
        {
            StockItem stockItem = new StockItem()
            {
                id    = pie.PieId,
                name  = pie.PieName,
                Price = pie.Price
            };

            _appDbContext.stockItems.Add(stockItem);
            _appDbContext.Pies.Add(pie);
            _appDbContext.SaveChanges();
        }
Пример #2
0
        public void EditPie(Pie the_pie, Pie pie)
        {
            StockItem stockItem = stockItemRepository.GetStockItemByName(the_pie.PieName);

            stockItem.name           = pie.PieName;
            stockItem.Price          = pie.Price;
            the_pie.PieName          = pie.PieName;
            the_pie.PiePhoto         = pie.PiePhoto;
            the_pie.Price            = pie.Price;
            the_pie.ShortDescreption = pie.ShortDescreption;
            the_pie.LongDescreption  = pie.LongDescreption;
            the_pie.CategoryId       = pie.CategoryId;

            _appDbContext.SaveChanges();
        }
Пример #3
0
 public void MakePieOfTheWeek(Pie pie)
 {
     pie.PiesOfTheWeek = true;
     _appDbContext.SaveChanges();
 }
Пример #4
0
 public void RemovePie(Pie pie)
 {
     _appDbContext.Pies.Remove(pie);
     _appDbContext.SaveChanges();
 }