Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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);
 }