Esempio n. 1
0
 public IActionResult Contact(ContactViewModel model)
 {
     if (ModelState.IsValid)
     {
         _mailService.SendMail(_config["MailSettings:To"], model.Email, "From TheWorld", model.Message);
         ModelState.Clear();
         ViewBag.UserMessage = "Message Sent";
     }
     return(View());
 }
Esempio n. 2
0
        public IActionResult Support(SupportViewModel model)
        {
            if (model.Email.Contains("aol.com"))
            {
                ModelState.AddModelError("Email", "We don't support aol addresses");
            }

            if (ModelState.IsValid)
            {
                _mailservice.SendMail(_config["MailSettings:ToAddress"], model.Email, model.Name + " | " + model.Phone, model.Message);
                ModelState.Clear();
                ViewBag.UserMessage = "We got your message! We will contact you back.";
            }
            return(View());
        }
        public IActionResult Contact(ContactViewModel model)
        {
            // hard coded
            if (model.Email.Contains("aol.com"))
            {
                ModelState.AddModelError("Email", "We don't support AOL addresses");
            }

            if (ModelState.IsValid)
            {
                _mailService.SendMail(_config["MailSettings:ToAddress"], model.Email, "From TheWorld", model.Message);
                ModelState.Clear();
                ViewBag.UserMessage = "Message sent "
                ;
            }

            return(View());
        }