//[Authorize(Roles = "Employee")] // GET: EmployeeJobInfoController/Details/5 public ActionResult Details(int id) { if (!_repo.isExists(id)) { return(NotFound()); } var empJobInfo = _repo.FindById(id); var model = _mapper.Map <EmployeeJobInfoVM>(empJobInfo); return(View(model)); }
// Creating a custom action public ActionResult SetWage(int id) { var empjobinfo = _empjobinforepo.FindById(id); var employees = _userManager.GetUsersInRoleAsync("Employee").Result; foreach (var emp in employees) { if (_empwagesrepo.CheckAllocation(id, emp.Id)) { continue; } var allocation = new EmployeeWagesVM { EmployeeId = emp.Id, EmployeeJobInfoId = id, MonthlyIncome = int.MaxValue, DailyRate = int.MaxValue, HourlyRate = int.MaxValue, Overtime = string.Empty, PercentSalaryHike = int.MaxValue }; var empwages = _mapper.Map <EmployeeWages>(allocation); _empwagesrepo.Create(empwages); } return(RedirectToAction(nameof(Index))); }