public ActionResult Create(UserProfile userprofile) { if (ModelState.IsValid) { db.UserProfiles.Add(userprofile); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SchoolId = new SelectList(db.Schools, "SchoolId", "SchoolName", userprofile.SchoolId); return View(userprofile); }
public ActionResult Edit(UserProfile userprofile) { if (ModelState.IsValid) { db.Entry(userprofile).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SchoolId = new SelectList(db.Schools, "SchoolId", "SchoolName", userprofile.SchoolId); return View(userprofile); }