public async Task <IActionResult> Create([Bind("Id,Name")] Topic topic) { if (ModelState.IsValid) { _context.Add(topic); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(topic)); }
public async Task <IActionResult> Create([Bind("Id,Name,Deadline,TopicId")] TodoTask todoTask) { try { if (ModelState.IsValid) { _context.Add(todoTask); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } }catch (RetryLimitExceededException) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator."); } PopulateTopicsDropDownList(todoTask.TopicId); return(View(todoTask)); }