public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,Description")] CategoryModel categoryModel) { if (id != categoryModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(categoryModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryModelExists(categoryModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(categoryModel)); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,Slug,ShortDescription,MainContent,CreatedDate,UpdatedDate")] PostModel postModel) { if (id != postModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(postModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostModelExists(postModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(postModel)); }