Exemplo n.º 1
0
 public ActionResult Create(Course course)
 {
     if (ModelState.IsValid)
     {
         db.Courses.Add(course);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.AddressId = new SelectList(db.Addresses, "Id", "PostalCode");
     return View(course);
 }
Exemplo n.º 2
0
 public ActionResult Edit(Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.AddressId = new SelectList(db.Addresses, "Id", "PostalCode");
     return View(course);
 }