public IActionResult SendEmailTOUser(ContactVm model) { Login login = new Login(); login.Email = _emailUser; login.ID = 0; Contact entity = new Contact(); entity.Email = _emailUser; entity.Name = _emailSubjec; entity.Message = model.Message; try { EmailServises _email = new EmailServises(login); _email.SendEmailFromAdmin(3, entity); DeleteEmail(); } catch (Exception) { throw; } return(Redirect("../Index?Curentpage=1")); }
public IActionResult ForgotPassword(ForgotPassM model) { if (ModelState.IsValid) { Login login = new Login(); List <Login> list = _servise.GetAll(x => x.Email == _encript.EncryptData(model.Email)); if (list.Count != 0) { EmailServises _email = new EmailServises(list[0]); _email.SendEmail(2); } else { ModelState.AddModelError(string.Empty, "Тhis email is not in our system."); return(View()); } } return(RedirectToAction("GoToEmail")); }
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"); }