public ActionResult Contact(EmailSendingViewModel emailSendingViewModel) { EmailSender emailSender = new EmailSender(); if (emailSendingViewModel.Email == null || emailSendingViewModel.Name == null || emailSendingViewModel.Comment == null) { TempData["Email"] = "You have to enter all the needed information for sending an email!"; return(View("Contact")); } emailSender.SendContactFormEmail(emailSendingViewModel.Email, emailSendingViewModel.Name, emailSendingViewModel.Comment); TempData["Email"] = "You have send the email successfully!"; return(View("Contact")); }
public ActionResult Contact(EmailSendingViewModel emailSendingViewModel) { EmailSender emailSender = new EmailSender(); if (emailSendingViewModel.Body == null || emailSendingViewModel.From == null || emailSendingViewModel.Subject == null) { TempData["Email"] = "You have to enter all the needed information for sending an email!"; return(View("Contact")); } emailSender.SendMail(emailSendingViewModel.From, emailSendingViewModel.Subject, emailSendingViewModel.Body); TempData["Email"] = "You have send the email successfully!"; return(View("Contact")); }
public ActionResult Index(EmailSendingViewModel emailSendingViewModel) { EmailSender emailSender = new EmailSender(); if (emailSendingViewModel.Comment == null || emailSendingViewModel.Name == null || emailSendingViewModel.Email == null) { ModelState.AddModelError("error_contact", " You have to enter all the needed information for sending an email!"); return(View()); } else { emailSender.SendEmail(emailSendingViewModel.Email, emailSendingViewModel.Name, emailSendingViewModel.Comment); TempData["Email"] = "You have send the email successfully!"; return(View("Contact")); } }