public Domain.Abstracts.ATopping Update(Domain.Abstracts.ATopping updated) { Entities.Topping topping = mapper.Map(updated, context, true); context.SaveChanges(); //context.ChangeTracker.Clear(); return(mapper.Map(topping)); }
public void Remove(Domain.Models.Topping t) { Entities.Topping dbTopping = mapper.Map(t); Entities.Topping topping = context.Toppings.ToList().Find(t => t.ToppingType == dbTopping.ToppingType); if (topping is not null) { context.Remove(topping); context.SaveChanges(); } }
public void Remove(int id) { Entities.Topping topping = context.Toppings.FirstOrDefault(t => t.ID == id); if (topping is not null) { context.Remove(topping); context.SaveChanges(); //context.ChangeTracker.Clear(); } }
public void Update(Domain.Models.Topping existing, Domain.Models.Topping updated) { Entities.Topping dbTopping = mapper.Map(existing); Entities.Topping topping = context.Toppings.ToList().Find(t => t.ToppingType == dbTopping.ToppingType); if (topping is not null) { Entities.Topping updatedTopping = mapper.Map(updated); topping.ToppingType = updatedTopping.ToppingType; topping.Price = updatedTopping.Price; context.SaveChanges(); } }
private void handleClick(Entities.Topping item) { if (SelectedTopping.Contains(item.ToppingId)) { SelectedTopping.Remove(item.ToppingId); } else { SelectedTopping.Add(item.ToppingId); } UpdatePrice(); }