public ActionResult Edit(courseType courseType) { try { var courseDetails = repo.Single(courseType.courseTypeID); if (courseDetails == null) { return(HttpNotFound()); } courseDetails.dataIsUpdated = BaseUtil.GetCurrentDateTime(); courseDetails.modifiedBy = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.UserID.ToString())); courseDetails.educationTypeID = courseType.educationTypeID; courseDetails.courseName = courseType.courseName; courseDetails.isActive = true; if (ModelState.IsValid) { repo.Update(courseDetails); return(RedirectToAction("Index")); } } catch (Exception e) { BaseUtil.CaptureErrorValues(e); } return(View(courseType)); }
// GET: Admin/CourseTypes/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } courseType courseType = repo.Single(id); if (courseType == null) { return(HttpNotFound()); } ViewBag.educationTypes = repo.SQLQuery <usp_GetAllEducationTypes_Admin_Result>("usp_GetAllEducationTypes_Admin").Select(e => new { e.educationTypeID, e.educationTypeName }).ToList(); return(View(courseType)); }
public ActionResult Create(courseType courseType) { try { if (ModelState.IsValid) { courseType.createdBy = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.UserID.ToString())); courseType.modifiedBy = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.UserID.ToString())); courseType.dataIscCreated = BaseUtil.GetCurrentDateTime(); courseType.dataIsUpdated = BaseUtil.GetCurrentDateTime(); repo.Insert(courseType); return(RedirectToAction("Index")); } } catch (Exception e) { BaseUtil.CaptureErrorValues(e); } return(RedirectToAction("Index")); }