// 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 _leaveallocationrepo.GetLeaveAllocationsByEmployee(id)); var model = new ViewAllocationViewModel { Employee = employee, LeaveAllocations = allocations }; return(View(model)); }
// GET: LeaveAllocationCotroller/Details/5 public ActionResult Details(string id) { var employee = _mapper.Map <EmployeeViewModel>(_userManager.FindByIdAsync(id).Result); var period = DateTime.Now; var allocations = _mapper.Map <List <LeaveAllocationViewModel> >(_leaveallocationrepo.GetLeaveAllocationsByEmployee(id)); var model = new ViewAllocationViewModel { Employee = employee, LeaveAllocations = allocations }; return(View(model)); }
// GET: LeaveAllocationController/Details/5 public async Task <ActionResult> Details(string id) { var employee = _mapper.Map <EmployeeViewModel>(await _userManager.FindByIdAsync(id)); var period = DateTime.Now.Year; var records = await _unitOfWork.LeaveAllocations.FindAll( expression : q => q.EmployeeId == id && q.Period == period, includes : new List <string> { "LeaveType" } ); //var records = await _leaveallocationrepo.GetLeaveAllocationsByEmployee(id); var allocations = _mapper.Map <List <LeaveAllocationViewModel> >(records); //var allocations = _mapper.Map<List<LeaveAllocationViewModel>>(records); var model = new ViewAllocationViewModel { Employee = employee, LeaveAllocations = allocations }; return(View(model)); }