public IActionResult Put(int id, ProjectTaskDTO model) { ProjectTask item = _taskRepo.GetById(id); if (item == null) { return(NotFound()); } model.UpdateFromModel(item); _taskRepo.SaveChanges(); return(NoContent()); }
public IActionResult Post(ProjectTaskDTO model) { ProjectTask item = new ProjectTask(); model.UpdateFromModel(item); _taskRepo.Add(item); _taskRepo.SaveChanges(); var dto = new ProjectTaskDTO { Id = item.Id, Title = item.Title, Description = item.Description, IsFinished = item.IsFinished, ProjectId = item.ProjectId, AssigneeId = item.AssigneeId }; return(CreatedAtAction(nameof(GetAll), dto)); }