public async Task <IActionResult> Edit(int id, [Bind("RecipeCommentsId,Comments,UserProfileId,RecipeId")] RecipeComments recipeComments) { if (id != recipeComments.RecipeCommentsId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(recipeComments); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RecipeCommentsExists(recipeComments.RecipeCommentsId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RecipeId"] = new SelectList(_context.Recipe, "RecipeId", "RecipeText", recipeComments.RecipeId); ViewData["UserProfileId"] = new SelectList(_context.UserProfile, "UserProfileId", "FirstName", recipeComments.UserProfileId); return(View(recipeComments)); }
public async Task <IActionResult> Edit(int id, [Bind("BlogArticleId,Title,BlogText")] BlogArticle blogArticle) { if (id != blogArticle.BlogArticleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(blogArticle); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BlogArticleExists(blogArticle.BlogArticleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(blogArticle)); }
public async Task <IActionResult> Edit(int id, [Bind("UserProfileId,FirstName,LastName,UserAccountId")] UserProfile userProfile) { if (id != userProfile.UserProfileId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(userProfile); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserProfileExists(userProfile.UserProfileId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(userProfile)); }
public async Task <IActionResult> Edit(int id, [Bind("RecipeId,Title,RecipeText")] Recipe recipe) { if (id != recipe.RecipeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(recipe); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RecipeExists(recipe.RecipeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(recipe)); }