// GET: LeaveAllocation/Details/5
        public ActionResult Details(string id)
        {
            var employee   = _mapper.Map <EmployeeVM>(_userManager.FindByIdAsync(id).Result);
            var allocation = _mapper.Map <List <LeaveAllocationVM> >(_leaveallocationrepo.GetLeaveAllocationByEmployee(id));
            var model      = new ViewAllocationVM {
                Employee = employee, LeaveAllocations = allocation
            };

            return(View(model));
        }
Example #2
0
        // GET: LeaveAllocation/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 _leaveallocationrepo.GetLeaveAllocationByEmployee(id));

            var model = new ViewAllocationViewModel {
                Employee         = employee,
                LeaveAllocations = allocations
            };

            return(View(model));
        }
Example #3
0
        public ActionResult MyLeave()
        {
            var employee            = _userManager.GetUserAsync(User).Result;
            var employeeAllocations = _leaveAllocationRepo.GetLeaveAllocationByEmployee(employee.Id);
            var employeeRequests    = _leaveHistoryRepo.GetLeaveRequestsByEmployee(employee.Id);

            var employeeAllocationVM = _mapper.Map <List <LeaveAllocationVM> >(employeeAllocations);
            var employeeHistoryVM    = _mapper.Map <List <LeaveHistoryVM> >(employeeRequests);

            var model = new EmployeeLeaveHistoryVM
            {
                LeaveAllocations = employeeAllocationVM,
                LeaveHistories   = employeeHistoryVM
            };

            return(View(model));
        }
Example #4
0
        public ActionResult EmployeeLeaveRequests()
        {
            var employee            = _userManager.GetUserAsync(User).Result;
            var employeeid          = employee.Id;
            var employeeAllocations = _leaveAllocRepo.GetLeaveAllocationByEmployee(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));
        }
        public async Task <ActionResult> MyLeave()
        {
            try
            {
                var user = await _userManager.GetUserAsync(User);


                var employeeAllocationsModel = _mapper.Map <List <LeaveAllocationViewModel> >(await _leaveaAllocationrepo.GetLeaveAllocationByEmployee(user.Id));
                var employeeRequestsModel    = _mapper.Map <List <LeaveRequestViewModel> >(await _leaveaRequestrepo.GetLeaveRequestsByEmployee(user.Id));

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

                return(View(model));
            }
            catch (Exception ex)
            {
                return(RedirectToAction(nameof(Index)));
            }
        }