public ActionResult Add(CourseForView viewCourse) { Course course = new Course(viewCourse); if (ModelState.IsValid) { _db.DbSet.Add(course); _db.SaveChanges(); } return RedirectToAction("Add"); }
public ActionResult Create(Course course) { if (ModelState.IsValid) { _db.DbSet.Add(course); _db.SaveChanges(); return RedirectToAction("Index"); } return View(course); }
public CourseForView(Course course) { Id = course.Id; Name = course.Name; SubjectIdList = (List<int>)_js.Deserialize(course.SubjectIdJson, typeof(List<int>)); }