// GET: LeaveAllocationController/Details/5 public async Task <ActionResult> Details(string id) { var x = await _allocationrepo.GetLeaveAllocationsByEmployee(id); var employee = _mapper.Map <EmployeeViewModel>(_userManager.FindByIdAsync(id).Result); var allocations = _mapper.Map <List <LeaveAllocationViewModel> >(x); var model = new ViewAllocationsViewModel { Employee = employee, LeaveAllocations = allocations }; return(View(model)); }
public async Task <ActionResult> MyLeave() { var user = await _userManager.GetUserAsync(User); var userId = user.Id; var requests = await _leaverequestrepo.GetLeaveRequestsByEmployeeId(userId); var allocations = await _leaveallocationrepo.GetLeaveAllocationsByEmployee(userId); var leaveRequests = _mapper.Map <List <LeaveRequestViewModel> >(requests.ToList()); var leaveAllocations = _mapper.Map <List <LeaveAllocationViewModel> >(allocations.ToList()); var model = new MyLeaveViewModel { LeaveRequests = leaveRequests, LeaveAllocations = leaveAllocations }; return(View(model)); }