Exemplo n.º 1
0
        public IActionResult SendEmail(PassengerInfoViewModel passengerInfo)
        {
            StringBuilder sb = FormatBody();

            MailMessage mail = new MailMessage();

            mail.To.Add(passengerInfo.ConfirmEmail);
            mail.From    = new MailAddress(EmailFormating.EmailSender);
            mail.Subject = EmailFormating.EmailSubject;
            string Body = sb.ToString().Trim();

            mail.Body       = Body;
            mail.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();

            smtp.Host = EmailFormating.EmailHost;
            smtp.Port = 587;
            smtp.UseDefaultCredentials = false;
            smtp.Credentials           = new System.Net.NetworkCredential(EmailFormating.EmailSender, EmailFormating.EmailSenderPassworfd); // Enter seders User name and password
            smtp.EnableSsl             = true;
            smtp.Send(mail);

            SaveData(passengerInfo.ConfirmEmail);

            return(View("ThanksForReservation"));
        }
Exemplo n.º 2
0
 public IActionResult ProcessPassengerInfo(PassengerInfoViewModel passengerInfo)
 {
     ModelClass.Passengers.Add(passengerInfo);
     ModelClass.PassengersCount -= 1;
     return(RedirectToAction("RegisterPassengers", "Reservations"));
 }