Example #1
0
        public ActionResult Contact(BGBC.Web.Models.Contact contact, bool captchaValid)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ContactForm contactform = new ContactForm();
                    contactform.MessageType = 1;
                    contactform.AccountName = contact.AccountName;
                    contactform.Name        = contact.Name;
                    contactform.EMail       = contact.EMail;
                    contactform.Phone       = contact.Phone;
                    contactform.MessageText = contact.MessageText;
                    _repository.Add(contactform);

                    MailSending mailsend = new MailSending();
                    //mailsend.ContactUs("*****@*****.**", contactform.Name, contactform.EMail, contactform.MessageText, contactform.Phone);

                    TempData["SucessMessage"] = "Message Successfully Send.";
                    return(RedirectToAction("Contact", "Home"));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
            }

            return(View(contact));
        }
Example #2
0
        public ActionResult ListHome(BGBC.Web.Models.Contact findlisthome)
        {
            try
            {
                ModelState["AccountName"].Errors.Clear();
                ModelState["MessageText"].Errors.Clear();
                if (ModelState.IsValid)
                {
                    ContactForm contactform = new ContactForm();
                    contactform.Name        = findlisthome.Name;
                    contactform.EMail       = findlisthome.EMail;
                    contactform.Phone       = findlisthome.Phone;
                    contactform.MessageText = findlisthome.MessageText;
                    contactform.MessageType = 2;
                    _repository.Add(contactform);

                    MailSending mailsend = new MailSending();
                    //mailsend.ContactRealtor("*****@*****.**", contactform.Name, contactform.EMail, contactform.MessageText, contactform.Phone);

                    TempData["SucessMessage"] = "Successfully Submit.";
                    return(RedirectToAction("ListHome", "Home"));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
            }

            return(View(findlisthome));
        }