public async Task <RemoveTaskResponse> RemoveTask(RemoveTaskRequest request) { var response = new RemoveTaskResponse(); await RunCodeAsync(MethodBase.GetCurrentMethod().Name, request, response, async (uow) => { await _manager.RemoveTask(request, response); }); return(response); }
public async Task RemoveTask(RemoveTaskRequest request, RemoveTaskResponse response) { await Task.Run(() => { var dbTask = _uow.Repository <TaskEntity>().GetDetails(t => t.Id == request.Id); if (dbTask != null) { var dbXrefBacklogTask = _uow.Repository <XRefBacklogTaskEntity>().GetDetails(x => x.TaskId == request.Id); if (dbXrefBacklogTask != null) { _uow.Repository <XRefBacklogTaskEntity>().Delete(dbXrefBacklogTask); } var dbXRefSprintTasks = _uow.Repository <XRefSprintTaskEntity>().GetOverview(x => x.TaskId == request.Id); if (dbXRefSprintTasks != null && dbXRefSprintTasks.Count() > 0) { _uow.Repository <XRefSprintTaskEntity>().DeleteMany(dbXRefSprintTasks); } _uow.Repository <TaskEntity>().Delete(dbTask); _uow.Save(); var backlogItems = GetBacklogTasks(new GetBacklogTasksRequest { TeamId = dbTask.TeamId }); if (backlogItems != null && backlogItems.Tasks.Count > 0) { response.Tasks = backlogItems.Tasks; } } else { response.Errors.Add("Sort Backlog items", "Cannot featch Backlog items"); } }); }