public IActionResult Create([FromBody] Task tarefa) { if (tarefa == null) { return(BadRequest()); } _taskRepository.Add(tarefa); return(CreatedAtRoute("GetTask", new { id = tarefa.Id }, tarefa)); }
public IActionResult Update(int id, [FromBody] Task tarefaUp) { if (tarefaUp == null || tarefaUp.Id != id) { return(BadRequest()); } var tarefa = _taskRepository.Find(id); if (tarefa == null) { return(NotFound()); } tarefa.Titulo = tarefa.Titulo; tarefa.Descricao = tarefa.Descricao; tarefa.Status = tarefa.Status; _taskRepository.Update(tarefa); return(new OkResult()); }