コード例 #1
0
        //[Authorize(Roles = "Employee")]
        // GET: EmployeeTypeDetailController/Details/5
        public ActionResult Details(int id)
        {
            if (!_repo.isExists(id))
            {
                return(NotFound());
            }
            var empTypeDetail = _repo.FindById(id);
            var model         = _mapper.Map <EmployeeTypeDetailVM>(empTypeDetail);

            return(View(model));
        }
コード例 #2
0
        // 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 EmployeeWageRateVM
                {
                    DateCreated       = DateTime.Now,
                    EmployeeId        = emp.Id,
                    EmployeeTypeId    = id,
                    MonthlyIncome     = int.MaxValue,
                    DailyRate         = int.MaxValue,
                    HourlyRate        = int.MaxValue,
                    Overtime          = string.Empty,
                    PercentSalaryHike = int.MaxValue,
                    Period            = DateTime.Now.Year,
                };
                var empwages = _mapper.Map <EmployeeWageRate>(allocation);
                _empwagesrepo.Create(empwages);
            }
            return(RedirectToAction(nameof(Index)));
        }