public IActionResult Update(Todo todoIn) { var todo = _todoService.Get(todoIn.Id); if (todo == null) { return(NotFound()); } _todoService.Update(todoIn); return(NoContent()); }
public async Task <IActionResult> Update(string id, TodoUpdateModel todoIn) { var todo = await _service.Get(id); if (todo == null) { return(NotFound()); } _service.Update(id, todoIn); return(Ok(todoIn)); }
public async Task <IActionResult> Update(string id, TodoItem todoItemIn) { var todoItem = await _todoService.GetTodoItem(id); if (todoItem == null) { _logger.LogWarning($"Item {id} not found"); return(NotFound()); } await _todoService.Update(id, todoItemIn); return(NoContent()); }
public IActionResult Update(string id, TodoItemCreateDTO todoItemDTO) { var todoItem = _todoService.Get(id); if (todoItem == null) { return(NotFound()); } todoItem.Name = todoItemDTO.Name; todoItem.IsComplete = todoItemDTO.IsComplete; _todoService.Update(id, todoItem); return(NoContent()); }
public IActionResult Update(long id, [FromBody] TodoItem item) { if (item == null || item.Id != id) { return(BadRequest()); } var todo = _service.GetById(id); if (todo == null) { return(NotFound()); } _service.Update(item); return(new NoContentResult()); }
public IActionResult Update(long id, [FromBody] TodoItem item) { if (item == null || item.Id != id) { return(BadRequest()); } var todo = _todoService.GetById(id); if (todo == null) { return(NotFound()); } todo.IsComplete = item.IsComplete; todo.Name = item.Name; _todoService.Update(todo); return(new NoContentResult()); }