public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(TodoTakeObject).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw new Exception($"Task! {TodoTakeObject.Id} not found!"); } return(RedirectToPage("./Index")); }