public ActionResult Create(Course course) { if (ModelState.IsValid) { course.DateCreated = DateTime.Now; course.ModifiedByLogin = User.Identity.Name; course.CreatedByLogin = User.Identity.Name; _repo.Add(course); return RedirectToAction("Index"); } ViewBag.IdCourseType = new SelectList(db.CourseTypes, "IdCourseType", "NameCourseType", course.IdCourseType); ViewBag.IdStatusValue = new SelectList(db.StatusValues, "IdStatusValue", "NameStatusValue", course.IdStatusValue); ViewBag.IdChartOfAccount = new SelectList(db.ChartOfAccounts, "IdChartOfAccount", "NumChartOfAccount", course.IdChartOfAccount); return View(course); }
public ActionResult Edit(Course course) { if (ModelState.IsValid) { _repo.Update(course); return RedirectToAction("Index"); } ViewBag.IdCourseType = new SelectList(db.CourseTypes, "IdCourseType", "NameCourseType", course.IdCourseType); ViewBag.IdStatusValue = new SelectList(db.StatusValues, "IdStatusValue", "NameStatusValue", course.IdStatusValue); ViewBag.IdChartOfAccount = new SelectList(db.ChartOfAccounts, "IdChartOfAccount", "NumChartOfAccount", course.IdChartOfAccount); return View(course); }
public void Remove(Course course) { _db.Courses.Remove(course); _db.SaveChanges(); }
public void Update(Course course) { _db.Entry(course).State = EntityState.Modified; _db.SaveChanges(); }
public void Add(Course course) { _db.Courses.Add(course); _db.SaveChanges(); }