this is my code
@{
Layout = null;
}
@{
ViewBag.Title = "EnterOTP";
}
EnterOTP
@*@ViewBag.otp*@
An Otp is send to your Email ,copy and paste here to confirm
var verifyotp = function () {
var otp = $('#enterotp').val();
debugger
$.ajax({
url: "/Signup/VerifyOTP",
data: otp,
type: "post",
success: function (data) {
debugger
if (data == true) {
alert("Verified successfully");
window.location = "/Login/Login";
}
else {
alert("Failed to verify OTp");
}
}
})
}
this is my action method
public ActionResult EnterOTP()
{
return View();
}
[HttpPost]
public JsonResult VerifyOTP(string otp)
{
using (var db = new OfficeEntities())
{
Account account = new Account();
db.Accounts.Where(x => x.Otp.ToString() ==otp );
// db.Entry(IsActive).State = EntityState.Modified;
account.IsActive = true;
db.SaveChanges();
}
return Json(, JsonRequestBehavior.AllowGet);
}
What I have tried:
i want to verify this
public ActionResult EnterOTP()
{
return View();
}
[HttpPost]
public JsonResult VerifyOTP(string otp)
{
using (var db = new OfficeEntities())
{
Account account = new Account();
db.Accounts.Where(x => x.Otp.ToString() ==otp );
// db.Entry(IsActive).State = EntityState.Modified;
account.IsActive = true;
db.SaveChanges();
}
return Json(, JsonRequestBehavior.AllowGet);
}