public async Task <IActionResult> Edit(Guid id, [Bind("Id,Title,Completed,Color")] ToDoItemViewModel toDoItem) { if (id != toDoItem.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await _toDo.EditAsync(new Item <Guid, string> { Id = toDoItem.Id, Color = toDoItem.Color, Title = toDoItem.Title, IsCompleted = toDoItem.IsCompleted }); } catch (DbUpdateConcurrencyException) { if (!ToDoItemExists(toDoItem.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(toDoItem)); }
public async Task <ActionResult> Edit(int id, [Bind("Id,Title,AssignedTo,AssignedBy,TenantId")] ToDoItem todo) { await _todoListService.EditAsync(todo); return(RedirectToAction("Index")); }