// GET: LeaveAllocations/Details/5 public ActionResult Details(string id) { var employee = _mapper.Map <EmployeeViewModel>(_userManager.FindByIdAsync(id).Result); var allocations = _mapper.Map <List <LeaveAllocationViewModel> >(_leaveallocationrepo.GetLeaveAllocationsByEmployee(id)); var model = new ViewAllocationsViewModel { 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 allocations = _mapper.Map <List <LeaveAllocationViewModel> >(await _allocationRepo.GetAllocationsByEmployee(id)); var model = new ViewAllocationsViewModel { Employee = employee, LeaveAllocations = allocations }; return(View(model)); }
// GET: LeaveAllocation/Details/5 public async Task <ActionResult> Details(string id) { var employee = _mapper.Map <EmployeeViewModel>(_userManager.FindByIdAsync(id).Result); var period = DateTime.Now.Year; var allocations = _mapper.Map <List <LeaveAllocationViewModel> >(await _unitOfWork.LeaveAllocations.FindAll(x => x.EmployeeId == id && x.Period == period)); var model = new ViewAllocationsViewModel { Employee = employee , LeaveAllocations = allocations }; return(View(model)); }
public async Task <ActionResult> Details(string employeeId) { var employee = await _userManager.FindByIdAsync(employeeId); var mappedEmployee = _mapper.Map <EmployeeViewModel>(employee); var allocations = await _unitOfWork.LeaveAllocations.FindAll(allocation => allocation.EmployeeId == employeeId, includes : new List <string> { "LeaveType" }); var mappedAllocations = _mapper.Map <List <LeaveAllocationViewModel> >(allocations); var model = new ViewAllocationsViewModel { Employee = mappedEmployee, LeaveAllocations = mappedAllocations, }; return(View(model)); }
// GET: LeaveAllocationController/Details/5 public async Task <ActionResult> Details(string Id) { EmployeeViewModel employee = _mapper .Map <EmployeeViewModel>( await _userManager.FindByIdAsync(Id) ); List <LeaveAllocationViewModel> allcations = _mapper .Map <List <LeaveAllocationViewModel> >( await _leaveallocationrepo.GetLeaveAllocationsByEmployee(Id) ); ViewAllocationsViewModel model = new ViewAllocationsViewModel { Employee = employee, LeaveAllocations = allcations }; return(View(model)); }