public ActionResult MyLeave()
        {
            var employee = _userManager.GetUserAsync(User).Result;

            var leaveallocation      = _AllocationRepo.GetLeaveAllocationsByEmployee(employee.Id);
            var leaveallocationModel = _mapper.Map <List <LeaveAllocationVM> >(leaveallocation);

            var leaverequest      = _LeaveRequestRepo.GetLeaveRequestByEmployeeID(employee.Id);
            var leaverequestModel = _mapper.Map <List <LeaveRequestVM> >(leaverequest);

            var model = new MyLeaveVM
            {
                LeaveAllocations = leaveallocationModel,
                LeaveRequests    = leaverequestModel
            };

            return(View(model));
        }
Пример #2
0
        public async Task <ActionResult> MyLeave()
        {
            var employee = await _userManager.GetUserAsync(User);

            //var allcations = _mapper.Map<List<LeaveAllocationViewModel>>(await _leaveAllocationRepository.GetLeaveAllocationsByEmployee(employee.Id));
            List <string> includes = new List <string> {
                "Employee", "LeaveType"
            };
            var allcations = _mapper.Map <List <LeaveAllocationViewModel> >(await _unitOfWork.LeaveAllocations.FindAll(expression: q => q.EmployeeId == employee.Id));
            //var leaveReqs = _mapper.Map<List<LeaveRequestVM>>(await _leaveRequestRepository.GetLeaveRequests(employee.Id));
            var leaveReqs = _mapper.Map <List <LeaveRequestVM> >(await _unitOfWork.LeaveRequests.FindAll(q => q.RequestingEmployeeId == employee.Id));
            var model     = new MyLeaveVM
            {
                LeaveAllocations = allcations,
                LeaveRequestVMs  = leaveReqs
            };

            return(View(model));
        }