public async Task <IActionResult> Edit(int id, [Bind("CustomerID,Title,Content,ImageURL,IsPublished")] CMS cMS) { if (id != cMS.CustomerID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cMS); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CMSExists(cMS.CustomerID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cMS)); }
public async Task <IActionResult> Create([Bind("CustomerID,Title,Content,ImageURL,IsPublished")] CMS cMS) { if (ModelState.IsValid) { _context.Add(cMS); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cMS)); }