public ActionResult Create([Bind(Include = "CourseID,Title,Credits")] Course course) { if (ModelState.IsValid) { db.Cources.Add(course); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(course)); }
public ActionResult Create([Bind(Include = "TransactionID,PacketID,Routes,Date")] Transaction transaction) { if (ModelState.IsValid) { db.Transactions.Add(transaction); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(transaction)); }
public Course CreateCourse(string title) { var newCourse = new Course { Title = title }; using (SolutionAcceleratorContext context = new SolutionAcceleratorContext()) { var createdCourse = context.Cources.Add(newCourse); context.SaveChanges(); return(createdCourse); } }