public ActionResult Create(UserProfile userprofile) { if (ModelState.IsValid) { db.UserProfile.Add(userprofile); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.MP_MemberShipId = new SelectList(db.MB_Membresia, "MP_MemberShipId", "MP_Descripcion", userprofile.MP_MemberShipId); ViewBag.PA_Id = new SelectList(db.PA_Paises, "PA_Id", "PA_Descripcion", userprofile.PA_Id); ViewBag.ST_Id = new SelectList(db.ST_Estatus, "ST_Id", "ST_Descripcion", userprofile.ST_Id); return View(userprofile); }
public ActionResult EditUser(UserProfile userprofile) { if (ModelState.IsValid) { if (TempData["UserImage"] != null) { userprofile.Image = TempData["UserImage"].ToString(); } else { userprofile.Image = "~/Images/No_Profile.jpg"; } db.Entry(userprofile).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("EditUser", "UserProfile", new { id = WebSecurity.CurrentUserId }); } ViewBag.MP_MemberShipId = new SelectList(db.MB_Membresia, "MP_MemberShipId", "MP_Descripcion", userprofile.MP_MemberShipId); ViewBag.PA_Id = new SelectList(db.PA_Paises, "PA_Id", "PA_Descripcion", userprofile.PA_Id); ViewBag.ST_Id = new SelectList(db.ST_Estatus, "ST_Id", "ST_Descripcion", userprofile.ST_Id); return View(userprofile); }