public async Task <TaskResponseModel> UpdateTaskById(int id, TaskRequestModel taskRequestModel) { var task = new ApplicationCore.Entities.Task() { Id = id, userid = taskRequestModel.userid, Title = taskRequestModel.Title, Description = taskRequestModel.Description, DueDate = taskRequestModel.DueDate, Priority = taskRequestModel.Priority, Remarks = taskRequestModel.Remarks, }; var createdTask = await _taskRepository.UpdateAsync(task); var taskResponse = new TaskResponseModel() { Id = createdTask.Id, userid = createdTask.userid, Title = createdTask.Title, Description = createdTask.Description, DueDate = createdTask.DueDate, Priority = createdTask.Priority, Remarks = createdTask.Remarks, }; return(taskResponse); }
public void AddTask(AddTaskRequest addTaskRequest) { var toAdd = new ApplicationCore.Entities.Task { Name = addTaskRequest.Name, Date = addTaskRequest.Date }; if (addTaskRequest.DependencyId == 0) { taskRepository.Add(toAdd); } else { var parent = taskRepository.GetById(addTaskRequest.DependencyId); if (parent.DependencyTasks == null) { parent.DependencyTasks = new List <Task>(); } parent.DependencyTasks.Add(toAdd); taskRepository.Update(parent); } }