// GET: LeaveAllocation/Details/5 public ActionResult Details(string id) { var employee = _mapper.Map <EmployeeVM>(_userManager.FindByIdAsync(id).Result); var allocation = _mapper.Map <List <LeaveAllocationVM> >(_leaveallocationrepo.GetLeaveAllocationByEmployee(id)); var model = new ViewAllocationVM { Employee = employee, LeaveAllocations = allocation }; return(View(model)); }
// GET: LeaveAllocation/Details/5 public async Task <ActionResult> Details(string id) { var employee = _mapper.Map <EmployeeVM>(await _userManager.FindByIdAsync(id)); var allocations = _mapper.Map <List <LeaveAllocationVM> >(await _repoleaveAllocation.GetLeaveAllocationsByEmployee(id)); var model = new ViewAllocationVM { Employee = employee, LeaveAllocationVMs = allocations }; return(View(model)); }
// GET: LeaveAllocation/Details/5 public async Task <ActionResult> Details(string id) //from int to string { var employee = _mapper.Map <EmployeeVM>(await _userManager.FindByIdAsync(id)); //whenever we get data we need map it //retrive all the leave allocation for this employee var allocations = _mapper.Map <List <LeaveAllocationVM> >(await _leaveallocationrepo.GetLeaveAllocationsByEmployee(id)); //list to VM var model = new ViewAllocationVM { Employee = employee, LeaveAllocations = allocations }; return(View(model)); }
// GET: LeaveAllocationController/Details/5 public ActionResult Details(string id) { var person = _mapper.Map <PersonVM>(_people.FindByIdAsync(id).Result); var period = DateTime.Now.Year; var allocations = _mapper.Map <List <LeaveAllocationVM> >(_repo.GetLeaveAllocationsByPerson(id)); var model = new ViewAllocationVM { Person = person, LeaveAllocations = allocations }; return(View(model)); }
// GET: LeaveAllocation/Details/5 public ActionResult Details(string id) { var employee = _mapper.Map <EmployeeVM>(_userManager.FindByIdAsync(id).Result); var period = DateTime.Now.Year; var allocations = _mapper.Map <List <LeaveAllocationVM> >(_repo.GetLeaveAllocations(id)); var model = new ViewAllocationVM { Employee = employee, LeaveAllocations = allocations }; return(View(model)); }
public ActionResult Details(string id) { var employee = _mapper.Map <EmployeeVM>(_userManager.FindByIdAsync(id).Result); var leaveAllocated = _mapper.Map <List <LeaveAllocationVM> >(_leaveAllocationRepo.FindAll().Where(x => x.EmployeeId == id && x.Period == DateTime.Now.Year)); var model = new ViewAllocationVM { Employee = employee, EmployeeId = employee.Id, LeaveAllocation = leaveAllocated }; //Bind the View with ViewAllocationVM //EmployeeId, EmployeeName, LeaveAllocationVMList return(View(model)); }
// GET: LeaveAllocationController/Details/5 public async Task <ActionResult> Details(string id) { var period = DateTime.Now.Year; var employee = _mapper.Map <EmployeeVM>(await _userManager.FindByIdAsync(id)); var allocations = _mapper.Map <List <LeaveAllocationVM> >(await _unitOfWork.LeaveAllocations.FindAll(k => k.EmployeeId == id && k.Period == period, includes: new List <string> { "LeaveType" })); var model = new ViewAllocationVM { Employee = employee, LeaveAllocations = allocations }; return(View(model)); }
// GET: LeaveAllocationController/Details/5 public async Task <ActionResult> Details(string id) { var employee = await _userManager.FindByIdAsync(id); var employeeVM = _mapper.Map <EmployeeVM>(employee); var period = DateTime.Now.Year; var allocations = await _leaveAllocationRepository.GetLeaveAllocationsByEmployee(employee.Id); var allocationVMs = _mapper.Map <List <LeaveAllocationVM> >(allocations); var model = new ViewAllocationVM { Employee = employeeVM, LeaveAllocationVMs = allocationVMs }; return(View(model)); }