public ATopping Update(ATopping updatedType) { DBTopping dBTopping = mapperTopping.Map(updatedType, context); context.SaveChanges(); return(mapperTopping.Map(dBTopping)); }
public void Remove(int id) { DBTopping topping = context.DBToppings.FirstOrDefault(topping => topping.ID == id); if (topping is not null) { context.Remove(topping); context.SaveChanges(); } }
public void Remove(Topping genericType) { DBTopping dBTopping = mapperTopping.Map(genericType); DBTopping topping = context.DBToppings.ToList().Find(topping => topping.TOPPING == dBTopping.TOPPING); if (topping is not null) { context.Remove(topping); context.SaveChanges(); } }
public void update(Topping existingType, Topping updatedType) { DBTopping dBTopping = mapperTopping.Map(existingType); DBTopping topping = context.DBToppings.ToList().Find(topping => topping.TOPPING == dBTopping.TOPPING); if (topping is not null) { DBTopping EntityMapped = mapperTopping.Map(updatedType); topping.TOPPING = EntityMapped.TOPPING; topping.Price = EntityMapped.Price; context.SaveChanges(); } }
public void Test_ToppingMapping() { // arrange MapperTopping mapperTopping = new MapperTopping(); var sut = new DBTopping(); sut.TOPPING = TOPPINGS.BACON; // act var sut2 = mapperTopping.Map(sut); var actual = sut2; // assert Assert.True(actual.TOPPING == TOPPINGS.BACON); }