public IActionResult PostIngredient(NewIngredient viewModel) { var ingredient = mapper.Map(viewModel); service.CreateNewIngredient(ingredient); return(RedirectToAction(nameof(GetIngredient), new { id = ingredient.Id })); }
public Ingredient Map(NewIngredient model) { return(new Ingredient { Id = Guid.NewGuid(), Name = model.Name, IsSour = model.IsSour, IsSpicy = model.IsSpicy, IsSugary = model.IsSugary, IngredientTypeId = model.IngredientTypeId }); }