public ActionResult Registration(CustomerRegistrationEntity customerRegistrationEntity) { StoreDBEntities1 entities = new StoreDBEntities1(); try { entities.spCustomerRegistration( customerRegistrationEntity.Email, customerRegistrationEntity.FName, customerRegistrationEntity.LName, customerRegistrationEntity.Address, customerRegistrationEntity.Password ); entities.SaveChanges(); ViewBag.Email = customerRegistrationEntity.Email; Random r = new Random(); Session["OTP"] = r.Next(1111, 9999); //change email parameter after testing bool emailSent = EmailVerification.SendEmailOTP(Convert.ToInt32(Session["OTP"]), "*****@*****.**", customerRegistrationEntity.FName); if (emailSent) { return(View("Verification")); } return(View("Registration")); } catch (Exception e) { Console.WriteLine(e.Message); } return(View("Registration")); }
public ActionResult Index(LoginAreaLogin login) { StoreDBEntities1 entities = new StoreDBEntities1(); ObjectParameter status = new ObjectParameter("Status", 0); ObjectResult <int?> logincode = entities.spCustomerLogin(login.Email, login.Password, status); int loginCode = (int)logincode.FirstOrDefault <int?>(); if (loginCode > 0) { if (loginCode > 1) { Session["CustomerEmail"] = login.Email; return(View("Shopping")); } ViewBag.CustomerVerification = false; ViewBag.Email = login.Email; Random r = new Random(); Session["OTP"] = r.Next(1111, 9999); //change email parameter after testing bool emailSent = EmailVerification.SendEmailOTP(Convert.ToInt32(Session["OTP"]), "*****@*****.**", login.Email); return(View("Verification")); } ViewBag.CustomerCredentials = false; return(View()); }