Beispiel #1
0
 public ActionResult SignIn(EventHub.DAL.User testUser)
 {
     try
     {
         // if user email and pwd matches
         if (Membership.ValidateUser(testUser.Email, testUser.Password))
         {
             FormsAuthentication.SetAuthCookie(testUser.Email, false);
             return(RedirectToAction("Index", "Home", new { area = "Common" }));
         }
         else
         {
             TempData["Msg"] = "Login Failed : ";
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception e)
     {
         TempData["Msg"] = "Login Failed : " + e.Message;
         return(RedirectToAction("Index"));
     }
 }
Beispiel #2
0
 public ActionResult Create(EventHub.DAL.User tempUser)
 {
     try
     {
         if (ModelState.IsValid)
         {
             tempUser.Role = "U";
             objBs.userBs.Insert(tempUser);
             TempData["Msg"] = "Created Successfully";
             return(RedirectToAction("index"));
         }
         else
         {
             return(View("index"));
         }
     }
     catch (Exception e)
     {
         TempData["Msg"] = "Creation Failed : " + e.Message;
         return(RedirectToAction("index"));
     }
 }