public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Desc,Complete,RepeatFreq,SelectedDay")] TaskApp2.Models.Task task) { if (id != task.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(task); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskExists(task.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(task)); }
public async Task <IActionResult> Create([Bind("ID,Name,Desc,Complete")] TaskApp2.Models.Task task) { if (ModelState.IsValid) { _context.Add(task); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(task)); }