public ActionResult ForgetPassword(string emailId) { mailservice obj = new mailservice(); UserProfile Model = new UserProfile(); var result = db.UserProfiles.Where(x => x.Email == emailId).ToList(); if (result.Count == 0) { Model = db.UserProfiles.Where(x => x.Email == emailId).FirstOrDefault(); return(View()); } else { obj.SendMailForgot(emailId); return(RedirectToAction("Index", "Login")); } }
public JsonResult SetNewPassword(string email, string setnewpass) { mailservice obj = new mailservice(); UserProfile Model = new UserProfile(); var result = db.UserProfiles.Where(x => x.Email == email).ToList(); if (result.Count > 0) { int update = db.Database.ExecuteSqlCommand("update UserProfile set Password='******' where Email='" + email + "'"); if (update > 0) { TempData["Mgs"] = "Your Password have been change sucessfully"; } } else { TempData["Mgs"] = "Your Password Not Change"; } return(Json(TempData["Mgs"], JsonRequestBehavior.AllowGet)); }