public ActionResult ForgotPassword(UserForgotPasswordModelClass modelforgotpasswordData) { if (ModelState.IsValid) { using (var database = new MvcTutorialEntities()) { var verify = database.tblUser.FirstOrDefault(user => user.MobileNo == modelforgotpasswordData.MobileNo); if (verify != null) { Session["ForgotPassword"] = verify.UserID; return(Json(new { msg = "success" }, JsonRequestBehavior.AllowGet)); //return RedirectToAction("ChangePassword"); } else { ViewBag.Message = "Mobile No is not exisit"; } } } return(View()); }
public HttpResponseMessage ForgotPassword(UserForgotPasswordModelClass modelForgotPasswordData) { try { if (ModelState.IsValid) { using (var database = new MvcTutorialEntities()) { var verify = database.tblUser.FirstOrDefault(user => user.MobileNo == modelForgotPasswordData.MobileNo); if (verify != null) { if (verify.IsActive == true) { return(this.GenerateResponse(true, HttpStatusCode.OK, verify.UserID)); } else { return(this.GenerateResponse(false, HttpStatusCode.Conflict, Constants.ACCOUNTINACTIVE)); } } else { return(this.GenerateResponse(false, HttpStatusCode.Conflict, Constants.MOBILENOTEXISTS)); } } } else { return(this.GenerateResponse(false, HttpStatusCode.NotFound, Constants.NODATA)); } } catch (Exception ex) { return(this.GenerateErrorResponse(HttpStatusCode.BadRequest, ex)); } }