示例#1
0
        public async Task <ActionResult> MyLeave()
        {
            var employee = await _userManager.GetUserAsync(User);

            var employeeId          = employee.Id;
            var employeeAllocations = await _allocationRepo.GetAllocationsByEmployee(employeeId);

            var employeeRequests = await _requestRepo.GetRequestsByEmployee(employeeId);

            var employeeAllocationsModel = _mapper.Map <List <LeaveAllocationViewModel> >(employeeAllocations);
            var employeeRequestsModel    = _mapper.Map <List <LeaveRequestViewModel> >(employeeRequests);

            var model = new EmployeeLeaveRequestViewModel
            {
                LeaveAllocations = employeeAllocationsModel,
                LeaveRequests    = employeeRequestsModel
            };

            return(View(model));
        }