public TaskWithActivity GetTaskWithActivity(int taskId) { TaskResponse objTaskResponse = this.GetTaskById(taskId); List <Feedback> objFeedbacks = _context.Feedbacks.Where(x => x.Type == 0 && x.TypeId == taskId).ToList(); Delivery objDelivery = _context.Deliveries.Where(x => x.TaskId == taskId).FirstOrDefault(); Rehersal objReherseal = _context.Rehersals.Where(x => x.TaskId == taskId).FirstOrDefault(); TaskWithActivity objTaskWithActivity = new TaskWithActivity { Feedbacks = objFeedbacks, TaskResponse = objTaskResponse, RehersalDetails = objReherseal, Delivery = objDelivery }; return(objTaskWithActivity); }
public ResponseModel <TaskWithActivity> GetTaskById(GetById objGetById) { try { TaskItemProvider objTaskItemProvider = new TaskItemProvider(_context); TaskWithActivity objTask = objTaskItemProvider.GetTaskWithActivity(objGetById.Id); ResponseModel <TaskWithActivity> objresponseModel = new ResponseModel <TaskWithActivity> { Message = "Successfully retrieved", StatusCode = 1, ResponseObject = objTask }; return(objresponseModel); } catch (Exception ex) { ResponseModel <TaskWithActivity> objresponseModel = new ResponseModel <TaskWithActivity> { Message = ex.Message, StatusCode = 0, }; return(objresponseModel); } }