public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Deadline,TopicId")] TodoTask todoTask) { if (id != todoTask.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(todoTask); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TodoTaskExists(todoTask.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } PopulateTopicsDropDownList(todoTask.TopicId); return(View(todoTask)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Topic topic) { if (id != topic.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(topic); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TopicExists(topic.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(topic)); }