public IActionResult Index() { LoginServise _login = new LoginServise(); if (!_login.CheckForAdmin()) { return(Redirect("Login/Registration")); } ProducLIst itemVM = new ProducLIst(); itemVM = PopulateIndex(itemVM); return(View(itemVM)); }
private string EnterLoginInformation(RegistrationVM reg) { Login login = new Login(); LoginVM loginVm = new LoginVM(); login.Email = _encript.EncryptData(reg.Email); if (reg.Password == reg.ConfirmPassword) { login.Password = _encript.EncryptData(reg.Password); if (!_servise.CheckForAdmin()) { login.isRegisted = true; login.Role = 1; _servise.Save(login); loginVm.Email = reg.Email; loginVm.Password = reg.Password; CreateCookie(loginVm); } else { login.isRegisted = false; login.Role = 2; _servise.Save(login); login = new Login(); login = _servise.GetLastElement(); EmailServises _email = new EmailServises(login); _email.SendEmail(1); } } else { return("Password no match"); } return("OK"); }