// GET: LeaveAllocationController/Details/5
        public async Task <ActionResult> Details(string id)
        {
            var employee    = _mapper.Map <EmployeeViewModel>(await _userManager.FindByIdAsync(id));
            var allocations = _mapper.Map <List <LeaveAllocationViewModel> >(await _allocationRepo.GetAllocationsByEmployee(id));
            var model       = new ViewAllocationsViewModel
            {
                Employee         = employee,
                LeaveAllocations = allocations
            };

            return(View(model));
        }
예제 #2
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));
        }