public ActionResult Create(EmployeeGradParam employeeGradParam) { if (ModelState.IsValid) { var gradParams = _employeeGradParamService.Get(egps => egps .Where(egp => egp.BeginDate == employeeGradParam.BeginDate && egp.EmployeeGradID == employeeGradParam.EmployeeGradID && egp.RoleType == employeeGradParam.RoleType ).ToList()); if (gradParams.Count > 0) { ModelState.AddModelError("EmployeeGradID", "Для связки 'Дата начала действия-Грейд-Тип роли' уже существует запись, измените один или несколько параметров."); } else if (employeeGradParam.EmployeeYearPayrollRatio < 1) { ModelState.AddModelError("EmployeeYearPayrollRatio", "% выплат от годовой зп не может быть меньше 1"); } } if (ModelState.IsValid) { _employeeGradParamService.Add(employeeGradParam); return(RedirectToAction("Index")); } ViewBag.EmployeeGrad = new SelectList(_employeeGradService.Get(x => x.ToList()).OrderBy(x => x.ShortName), "ID", "FullName"); return(View(employeeGradParam)); }
public ActionResult DeleteConfirmed(int id) { EmployeeGradParam gradParam = _employeeGradParamService.GetById(id); int gradParamID = gradParam.ID; if (gradParam != null) { _employeeGradParamService.Delete(gradParam.ID); } // string returnUrl = Url.Action("Index"); return(RedirectToAction("Index")); // return new RedirectResult(returnUrl); }
public ActionResult Details(int?id) { if (id == null) { return(StatusCode(StatusCodes.Status400BadRequest)); } EmployeeGradParam gradParam = _employeeGradParamService.GetById(id.Value); if (gradParam == null) { return(StatusCode(StatusCodes.Status404NotFound)); } ; return(View(gradParam)); }
public ActionResult Edit(int?id) { if (id == null) { return(StatusCode(StatusCodes.Status400BadRequest)); } EmployeeGradParam gradParam = _employeeGradParamService.GetById(id.Value); if (gradParam == null) { return(StatusCode(StatusCodes.Status404NotFound)); } ; ViewBag.EmployeeGrad = new SelectList(_employeeGradService.Get(x => x.ToList()).OrderBy(x => x.ShortName), "ID", "FullName", gradParam.EmployeeGradID); return(View(gradParam)); }