// GET: LeaveAllocationController/Details/5 public async Task <ActionResult> Details(string id) { var employee = _mapper.Map <EmployeeViewModel>(_userManager.FindByIdAsync(id).Result); var allocations = _mapper.Map <List <LeaveAllocationViewModel> >(await _allocationrepo.GetLeaveAllocationsByEmployee(id)); var model = new ViewLeaveAllocationsViewModel { Employee = employee, LeaveAllocation = allocations }; return(View(model)); }
// 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)); }
// GET: LeaveAllocationController/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 _unitOfWork.LeaveAllocations.FindAll(q => q.EmployeeId == id, includes: new List <string> { "LeaveType" })); var model = new ViewLeaveAllocationsViewModel { Employee = employee, EmployeeId = id, LeaveAllocations = allocations }; return(View(model)); }