public async Task <ActionResult> MyLeave() { var EmployeeId = _userManager.GetUserAsync(User).Result.Id; var requests = await _requestRepo.GetLeaveRequestByEmployee(EmployeeId); var allocations = await _allocationRepo.GetLeaveAllocationsByEmployee(EmployeeId); var MappedAllocations = _mapper.Map <List <LeaveAllocationVM> >(allocations.ToList()); var MappedRequest = _mapper.Map <List <LeaveRequestVM> >(requests.ToList()); var model = new MyEmployeeLeaveVM { LeaveAllocations = MappedAllocations, LeaveRequests = MappedRequest }; return(View(model)); }
public ActionResult MyLeave() { var employee = _userManager.GetUserAsync(User).Result; var employeeId = employee.Id; var employeeAllocations = _leaveAllocRepo.GetLeaveAllocationsByEmployee(employeeId); var employeeRequests = _leaveRequestRepo.GetLeaveRequestByEmployee(employeeId); var employeeAllocModel = _mapper.Map <List <LeaveAllocationVM> >(employeeAllocations); var employeeRequestModel = _mapper.Map <List <LeaveRequestVM> >(employeeRequests); var model = new EmployeeLeaveRequestViewVM { LeaveAllocations = employeeAllocModel, LeaveRequests = employeeRequestModel }; return(View(model)); }
public async Task <ActionResult> MyLeave() { var employee = await _userManager.GetUserAsync(User); var employeeid = employee.Id; var employeeAllocations = await _leaveAllocRepo.GetLeaveAllocationsByEmployee(employeeid); var employeeRequests = await _leaveRequestRepo.GetLeaveRequestByEmployee(employeeid); var employeeAllocationsModel = _mapper.Map <List <LeaveAllocationVM> >(employeeAllocations); var employeeRequestsModel = _mapper.Map <List <LeaveRequestVM> >(employeeRequests); var model = new EmployeeLeaveRequestViewVM { LeaveAllocations = employeeAllocationsModel, LeaveRequests = employeeRequestsModel }; return(View(model)); }