public async System.Threading.Tasks.Task AddSubTask(Task task) { var parentTask = _context.Tasks.Include(y => y.SubTasks).Where(x => x.Id == task.ParentId).First(); parentTask.SubTasks.Add(task); await _context.SaveChangesAsync(); }
public async System.Threading.Tasks.Task Delete(int id) { var task = new Task { Id = id }; _context.Tasks.Remove(task); await _context.SaveChangesAsync(); }
public async Task <IActionResult> Update([FromBody] UpdateTaskRequest updateTaskRequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Task taskEntity = await _taskRepository.FindByIdAsync(updateTaskRequest.TaskId.Value); taskEntity.Name = updateTaskRequest.Name; taskEntity.Description = updateTaskRequest.Description; taskEntity.StartDate = updateTaskRequest.StartDate.Value; taskEntity.FinishDate = updateTaskRequest.FinishDate.Value; taskEntity.State = updateTaskRequest.State.Value; await _taskRepository.Update(taskEntity); return(Ok()); }
public async System.Threading.Tasks.Task Update(Task task) { _context.Tasks.Update(task); await _context.SaveChangesAsync(); }