示例#1
0
        // GET: LeaveAllocation/Details/5
        public ActionResult Details(string id)
        {
            var employee    = _mapper.Map <EmployeeVM>(_userManager.FindByIdAsync(id).Result);
            var allocations = _mapper.Map <List <LeaveAllocationVM> >(_leaveallocationrepo.GetLeaveAllocationsByEmployee(id));
            var model       = new ViewAllocationsVM
            {
                Employee         = employee,
                LeaveAllocations = allocations
            };

            return(View(model));
        }
        public ActionResult MyLeave()
        {
            var employee            = _userManager.GetUserAsync(User).Result;
            var employeeid          = employee.Id;
            var employeeAllocations = _leaveAllocRepo.GetLeaveAllocationsByEmployee(employeeid);
            var employeeRequests    = _leaveRequestRepo.GetLeaveRequestsByEmployee(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));
        }