public ActionResult AdminLogin(UserInfo user) { var v = _entities.UserInfoes.Where(a => a.Email.Equals(user.Email) && a.Password.Equals(user.Password) && a.UserRole.Equals("Admin")).FirstOrDefault(); if (v != null) { Session["LoggedAdminId"] = v.Id.ToString(); Session["LoggedUserName"] = v.UserName.ToString(); return RedirectToAction("Home", "Admin"); } else { Session["LoginFailed"] = "Username or Password doesn't match"; return RedirectToAction("AdminLogin", "Admin"); } }
public ActionResult Register(UserInfo member) { if (_validation.UserNameIfExist(member.UserName)) { ModelState.AddModelError("UserName", "Username already exist. Try using Symbols and Numbers"); return View(member); } if (_validation.EmailIfExist(member.Email)) { ModelState.AddModelError("Email", "Email already exist"); return View(member); } member.JoinDate = DateTime.Now; member.UserRole = "User"; member.IsActive = true; if (ModelState.IsValid) { _entities.UserInfoes.Add(member); _entities.SaveChanges(); ModelState.Clear(); member = null; ViewBag.Message = "Registration Successfully Completed"; } return View(member); }
public ActionResult ChangePassword(UserInfo user) { if (ModelState.IsValid) { _entities.UserInfoes.Add(user); _entities.SaveChanges(); return RedirectToAction("DashBoardforMyProfile/" + Session["LoggedUserId"]); } return View(user); }
public ActionResult ChangePersonalInfo_Post(UserInfo user) { if (ModelState.IsValid) { _entities.Entry(user).State = EntityState.Modified; _entities.SaveChanges(); return RedirectToAction("DashBoardforMyProfile", new { id = user.Id }); } return View(user); }
public ActionResult ChangeContactInfo(UserInfo user) { if (ModelState.IsValid) { _entities.Entry(user).State = EntityState.Modified; _entities.SaveChanges(); //return RedirectToAction("DashBoardforMyProfile/" + Session["Id"]); return RedirectToAction("DashBoardforMyProfile", new { id = user.Id }); } return View(user); }