public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Status,CreateDate,EditDate,Description,Deadline")] CMSTask cMSTask) { if (id != cMSTask.ID) { return(NotFound()); } if (ModelState.IsValid) { try { cMSTask.Completed(); _context.Update(cMSTask); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CMSTaskExists(cMSTask.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(cMSTask)); }
public async Task <IActionResult> Create([Bind("ID,Title,Status,CreateDate,EditDate,Description,Deadline")] CMSTask cMSTask) { if (ModelState.IsValid) { cMSTask.Initialize(); _context.Add(cMSTask); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cMSTask)); }