public async Task <ActionResult> MyLeave() { Employee employee = await _userManager.GetUserAsync(User); string employeeId = employee.Id; ICollection <LeaveAllocation> employeeAllocations = await _leaveAllocationRepo .GetLeaveAllocationsByEmployee(employeeId); ICollection <LeaveRequest> employeeRequests = await _leaveRequestRepo .GetLeaveRequestsByEmployee(employeeId); List <LeaveAllocationViewModel> employeeAllocationsModel = _mapper .Map <List <LeaveAllocationViewModel> >(employeeAllocations); List <LeaveRequestViewModel> employeeRequestsModel = _mapper .Map <List <LeaveRequestViewModel> >(employeeRequests); EmployeeLeaveRequestViewViewModel model = new EmployeeLeaveRequestViewViewModel { LeaveAllocations = employeeAllocationsModel, LeaveRequests = employeeRequestsModel }; return(View(model)); }
public async Task <ActionResult> MyLeave() { var employee = await _userManager.GetUserAsync(User); var allocations = await _unitOfWork.LeaveAllocations.Find(q => q.EmployeeId == employee.Id); var leaveAllocationsModel = _mapper.Map <List <LeaveAllocationViewModel> >(allocations); var leaveRequests = await _unitOfWork.LeaveRequests.FindAll(q => q.RequestingEmployeeId == employee.Id, includes : new List <string> { "LeaveType" }); var leaveRequestsModel = _mapper.Map <List <LeaveRequestViewModel> >(leaveRequests); var model = new EmployeeLeaveRequestViewViewModel { LeaveAllocations = leaveAllocationsModel, LeaveRequests = leaveRequestsModel }; return(View(model)); }