public JsonResult AjaxLogin(string EmailAddress, string Password) { try { Models.CUser User = new Models.CUser(); User = User.Login(EmailAddress, Password); if (User.ActionStatus == Models.CUser.ActionStatusTypes.UserLoggedIn) { User.SetCurrentUser(); return(Json(new { FirstName = User.FirstName , LastName = User.LastName , UserID = User.UserID , ActionStatus = User.ActionStatus })); } else { return(Json(new { FirstName = "" , LastName = "" , UserID = 0 , ActionStatus = Models.CUser.ActionStatusTypes.FailedLogin })); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult SignUp(FormCollection Collection) { try { Models.CUser User = new Models.CUser(); User.EmailAddress = Collection["EmailAddress"]; User.FirstName = Collection["FirstName"]; User.LastName = Collection["LastName"]; User.Password = Collection["Password"]; User.strCity = Collection["strCity"]; User.intStateID = Convert.ToInt32(Collection["intStateID"]); User.intGenderID = Convert.ToInt32(Collection["intGenderID"]); Models.CUser.ActionStatusTypes Status = User.Save(); switch (Status) { case Models.CUser.ActionStatusTypes.UserAlreadyExists: break; case Models.CUser.ActionStatusTypes.UserUpdated: User.SetCurrentUser(); return(RedirectToAction("MyProfile", "User")); default: break; } return(View(User)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult MyProfile(FormCollection Collection) { try { Models.CUser User = new Models.CUser(); Models.CUser CurrentUser = User.GetCurrentUser(); User.UserID = CurrentUser.UserID; User.EmailAddress = Collection["EmailAddress"]; User.FirstName = Collection["FirstName"]; User.LastName = Collection["LastName"]; User.Password = Collection["Password"]; Models.CUser.ActionStatusTypes Status = User.Save(); switch (Status) { case Models.CUser.ActionStatusTypes.UserAlreadyExists: break; case Models.CUser.ActionStatusTypes.UserUpdated: CurrentUser = null; User.SetCurrentUser(); return(RedirectToAction("Home", "Home")); default: break; } return(View(User)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Login(FormCollection Collection) { try { Models.CDatabase db = new Models.CDatabase(); Models.CUser User = new Models.CUser(); User.EmailAddress = Collection["EmailAddress"]; User.Password = Collection["Password"]; User = User.Login(User.EmailAddress, User.Password); if (User.UserID > 0) { User.SetCurrentUser(); return(RedirectToAction("Home", "Home")); } else { return(View(User)); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult SignUp(FormCollection Collection) { try { if (ModelState.IsValid) { Models.CUser User = new Models.CUser(); User.EmailAddress = Collection["EmailAddress"]; User.FirstName = Collection["FirstName"]; User.LastName = Collection["LastName"]; User.Password = Collection["Password"]; User.strCity = Collection["strCity"]; User.strAddress = Collection["strAddress"]; if (Collection["dtmDateOfBirth"] != "") { User.dtmDateOfBirth = Convert.ToDateTime(Collection["dtmDateOfBirth"]); } else { User.dtmDateOfBirth = DateTime.MinValue; } User.intStateID = Convert.ToInt32(Collection["intStateID"]); User.intGenderID = Convert.ToInt32(Collection["intGenderID"]); User.strZipCode = Collection["strZipCode"]; string str = Collection["blnEmailList"]; if (Collection["blnEmailList"] == "true,false") { User.blnEmailList = true; } else { User.blnEmailList = false; } //User.blnEmailList = Convert.ToInt32(Collection["blnEmailList"]); Models.CUser.ActionStatusTypes Status = User.Save(); switch (Status) { case Models.CUser.ActionStatusTypes.UserAlreadyExists: break; case Models.CUser.ActionStatusTypes.UserUpdated: User.SetCurrentUser(); return(RedirectToAction("MyProfile", "User")); default: break; } } return(View(User)); } catch (Exception ex) { throw new Exception(ex.Message); } }