コード例 #1
0
 // GET: GeneralUsers/Create
 public ActionResult Create()
 {
     if (System.Web.HttpContext.Current.User.IsInRole("Admin") || System.Web.HttpContext.Current.User.IsInRole("GeneralUser") || System.Web.HttpContext.Current.User.IsInRole("Applicant") || System.Web.HttpContext.Current.User.IsInRole("GeneralUser"))
     {
         return RedirectToAction("Index", "Home");
     }
     RegisteredUser registeredUser = new RegisteredUser();
     GeneralUser generalUser = new GeneralUser();
    
     generalUser.RegisteredUser = registeredUser;
     return View(generalUser);
 }
コード例 #2
0
        public ActionResult Create(GeneralUser generalUser)
        {
            if (ModelState.IsValid)
            {
                generalUser.RegisteredUser.IsActivated = "Yes";
                TempData["code"] = sendSms(generalUser.RegisteredUser.PhoneNo);
                TempData["generalUser"] = generalUser;
                
                return RedirectToAction("GetVerified");
            }

            return View(generalUser);
        }
コード例 #3
0
 public ActionResult Edit( GeneralUser generalUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(generalUser).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(generalUser);
 }
コード例 #4
0
 public ActionResult Edit( GeneralUser generalUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(generalUser).State = EntityState.Modified;
         db.Entry(generalUser.RegisteredUser).State = EntityState.Modified;
         db.SaveChanges();
         string username = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;
         if (!generalUser.RegisteredUser.UserName.Equals(username))
         {
             FormsAuthentication.SignOut();
             Session.Abandon();
         }
         return RedirectToAction("Index", "Home");
     }
     return View(generalUser);
 }