public ActionResult Edit(Models.CorporateEmployeeGradeModel data) { try { if (ModelState.IsValid) { long cid = 0; long.TryParse(User.Identity.GetUserId(), out cid); CLayer.EmployeeGrades empGrade = new CLayer.EmployeeGrades(); { empGrade.GradeID = data.GradeID; empGrade.GradeCode = data.GradeCode; empGrade.GradeDescription = data.GradeDescription; empGrade.B2B_ID = cid; }; BLayer.EmployeeGrades.Save(empGrade); ViewBag.Saved = true; } else { ViewBag.Saved = false; } return(RedirectToAction("Index")); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/ErrorPage")); } }
// GET: CorporateEmployeeGrades/Edit/5 public ActionResult Edit(int id) { try { ViewBag.Saved = false; Models.CorporateEmployeeGradeModel data = new Models.CorporateEmployeeGradeModel() { GradeID = 0 }; CLayer.EmployeeGrades employeegrades = BLayer.EmployeeGrades.Get(id); if (employeegrades != null) { data = new Models.CorporateEmployeeGradeModel() { GradeID = employeegrades.GradeID, GradeCode = employeegrades.GradeCode, GradeDescription = employeegrades.GradeDescription, B2B_ID = employeegrades.B2B_ID } } ; return(PartialView("~/Views/CorporateEmployeeGrades/_Edit.cshtml", data)); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/ErrorPage")); } }