Example #1
0
 public ContactUsPage EnterContactDetails(ContactUsFormModel contactUsFormModel)
 {
     Find(YourName).SendKeys(contactUsFormModel.Name);
     Find(YourEmail).SendKeys(contactUsFormModel.Email);
     //This looks odd, but it does describe what the page and data are doing and how the names differ
     Find(YourCompany).SendKeys(contactUsFormModel.Subject);
     Find(YourMessage).SendKeys(contactUsFormModel.Message);
     return(this);
 }
Example #2
0
 public void ContactUs(ContactUsFormModel form)
 {
     try
     {
         _contactUsRepository.Save(form);
     }
     catch (Exception ex)
     {
         //TODO: Log Error
         throw;
     }
 }
        public ActionResult Contact(ContactUsFormModel emailModel)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            else
            {
                try
                {
                    //Setup MailMessage
                    using (MailMessage msg = new MailMessage())
                    {
                        msg.From = new MailAddress(emailModel.Email, emailModel.Name);
                        msg.ReplyToList.Add(msg.From);
                        msg.To.Add(new MailAddress("*****@*****.**", "KSU Lacrosse"));
                        msg.Subject = emailModel.Subject;
                        string body = "Name: " + emailModel.Name + "\n"
                                      + "Company Name: " + emailModel.CompanyName + "\n"
                                      + "Email: " + emailModel.Email + "\n"
                                      + "Phone: " + emailModel.Phone + "\n\n"
                                      + emailModel.Comments;

                        msg.Body       = body;
                        msg.IsBodyHtml = false;

                        //Send the Email
                        using (SmtpClient client = smtpClient())
                        {
                            client.Send(msg);
                        }
                    }

                    MessageModel rcpt = new MessageModel();
                    rcpt.Title   = "Thanks " + emailModel.Name + "!";
                    rcpt.Content = "We appreciate you taking the time to get in contact with us. We will do our best to be in touch with you quickly.";
                    return(View("Message", rcpt));
                }

                catch (Exception e)
                {
                    //Log in ELMAH
                    logELMAH(e);

                    //Show an error
                    return(View("Message", errorMessage()));
                }
            }
        }
Example #4
0
 public void Save(ContactUsFormModel contactUsForm)
 {
     //TODO: Save to DB
     throw new NotImplementedException();
 }
Example #5
0
        public ActionResult ContactUs(ContactUsFormModel form)
        {
            _formService.ContactUs(form);

            return(View());
        }