public void EditPizzaSizePrice(PizzaSizeModel pizzaSize) { var pizzaSizeInDb = GetPizzaSizeById(pizzaSize.PizzaSizeId); if (pizzaSizeInDb != null) { pizzaSizeInDb.Price = pizzaSize.Price; _dbContext.Update(pizzaSizeInDb); _dbContext.SaveChanges(); } }
public static PizzaSizeViewModel ToViewModel(this PizzaSizeModel model) { return(new PizzaSizeViewModel { PizzaSizeId = model.PizzaSizeId, PizzaId = model.PizzaId, PizzaName = model.Pizza.Name, SizeId = model.SizeId, SizeName = model.Size.Name, Price = model.Price }); }
public void AddPizzaSize(PizzaSizeModel pizzaSize) { _dbContext.PizzaSizes.Add(pizzaSize); _dbContext.SaveChanges(); }