public void UpdateIngredient(WhatYouGotLibrary.Models.Ingredient ingredient) { Entities.Ingredient currentIngredient = _context.Ingredient.Find(ingredient.Id); Entities.Ingredient newIngredient = Mapper.Map(ingredient); _context.Entry(currentIngredient).CurrentValues.SetValues(newIngredient); }
public static Entities.Ingredient Map(WhatYouGotLibrary.Models.Ingredient ingredient) { return(new Entities.Ingredient { Id = ingredient.Id, RecipeId = ingredient.RecipeId, ImageUrl = ingredient.ImageUrl, IngredientName = ingredient.IngredientName, Amount = ingredient.Amount, Unit = ingredient.Unit }); }
public void AddIngredient(WhatYouGotLibrary.Models.Ingredient ingredient) { Entities.Ingredient newIngredient = Mapper.Map(ingredient); _context.Add(newIngredient); }