public IActionResult AddEdit(RecipeEdits suggestedRecipeEdit) { _repo.RecipeEdits.Create(suggestedRecipeEdit); _repo.Save(); return(RedirectToAction("Index")); }
public IActionResult SubmitEdit(int?id) { if (id == null) { return(NotFound()); } var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); var loggedInCook = _repo.Cook.FindByCondition(e => e.IdentityUserId == userId).SingleOrDefault(); var recipe = _repo.Recipe.FindByCondition(r => r.RecipeId == id).FirstOrDefault(); RecipeEdits suggestedEdit = new RecipeEdits(); suggestedEdit.RecipeID = recipe.RecipeId; suggestedEdit.CookId = loggedInCook.CookId; //return RedirectToAction(nameof(SubmitEdit)); return(View(suggestedEdit)); }