// GET: LeaveAllocationController/Details/5
        public async Task <IActionResult> Details(string employeeId)
        {
            var employeeVM        = mapper.Map <EmployeeVM>(await userManager.FindByIdAsync(employeeId));
            var leaveAllocations  = mapper.Map <List <LeaveAllocationVM> >((await leaveAllocationRepository.GetLeaveAllocationsByEmployeeId(employeeId)).ToListAsync());
            var viewAllocationsVM = new ViewAllocationsVM
            {
                EmployeeVM         = employeeVM,
                EmployeeId         = employeeId,
                LeaveAllocationVMs = leaveAllocations
            };

            return(View(viewAllocationsVM));
        }
        // GET: LeaveAllocationController/Details/5
        public ActionResult Details(string id)
        {
            var employee         = _mapper.Map <EmployeeViewModel>(_userManager.FindByIdAsync(id).Result);
            var leaveAllocations = _mapper.Map <List <LeaveAllocationViewModel> >(_repo.GetLeaveAllocationsByEmployeeId(id, DateTime.Now.Year));

            var model = new ViewLeaveAllocationsViewModel
            {
                Employee         = employee,
                EmployeeId       = id,
                LeaveAllocations = leaveAllocations
            };

            return(View(model));
        }
        public ActionResult Myleave()
        {
            var employee             = _userManager.GetUserAsync(User).Result;
            var employeeid           = employee.Id;
            var employeeallocations  = _leavAllocationrepo.GetLeaveAllocationsByEmployeeId(employeeid);
            var employeeleaverequest = _leaveRequestrepo.GetLeaveRequestByEmployeeId(employeeid);

            var emoployeeallocationsModel = _mapper.Map <List <LeaveAllocationVM> >(employeeallocations);

            var emoployeerequestModel = _mapper.Map <List <LeaveRequestVM> >(employeeleaverequest);

            var model = new EmployeeRequestViewVM
            {
                LeaveAllocationVMs = emoployeeallocationsModel,
                LeaveRequests      = emoployeerequestModel
            };

            return(View(model));
        }
예제 #4
0
        public ActionResult MyLeave()
        {
            try
            {
                var employee = _userManager.GetUserAsync(User).Result;

                var allocations   = _mapper.Map <List <LeaveAllocationViewModel> >(_leaveAllocationRepo.GetLeaveAllocationsByEmployeeId(employee.Id, DateTime.Now.Year));
                var leaveRequests = _mapper.Map <List <LeaveRequestViewModel> >(_repo.GetLeaveRequestsByEmployeeId(employee.Id));

                var model = new EmployeeLeaveRequestViewModel
                {
                    LeaveAllocations = allocations,
                    LeaveRequests    = leaveRequests
                };

                return(View(model));
            }
            catch
            {
                return(RedirectToAction(nameof(Index), "Home"));
            }
        }