Exemplo n.º 1
0
        public async Task <IActionResult> InsertContactUsConfirm(ContactUsViewModel model)
        {
            if (ModelState.IsValid)
            {
                ContactUs contactUs = new ContactUs()
                {
                    Name         = model.Name,
                    Email        = model.Email,
                    Comment      = model.Comment,
                    RegdDateTime = DateTime.Now,
                };
                if (User.Identity.IsAuthenticated)
                {
                    ApplicationUser user = await userManager.FindByNameAsync(User.Identity.Name);

                    contactUs.UserId = user.Id;
                }
                try
                {
                    dbContactUs.Insert(contactUs);
                    return(Json(new { status = true }));
                }
                catch (Exception)
                {
                    return(Json(new { status = false }));
                }
            }
            return(Json(new { status = false }));
        }
Exemplo n.º 2
0
        public ActionResult ContactUs(ContactUsViewModel userInput)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var email = new MailMessage(new MailAddress("*****@*****.**"),
                                        new MailAddress("[email protected] "));

            email.Subject = "Contact Us Entry";
            email.Body    = "Name = " + userInput.Name + "\nEmail = " + userInput.Email
                            + "\nPhone Number = " + userInput.PhoneNumber + "\nMessage = " + userInput.Message;
            email.IsBodyHtml = true;
            using (var smtp = new SmtpClient())
            {
                var credential = new NetworkCredential
                {
                    UserName = "******",
                    Password = "******"
                };
                smtp.Credentials = credential;
                smtp.Host        = "smtpout.secureserver.net ";
                smtp.Port        = 3535;
                smtp.EnableSsl   = false;
                smtp.Timeout     = 10000;
                smtp.Send(email);
            }

            return(View());
        }
        private string getBodyHtml(ContactUsViewModel model)
        {
            StringBuilder strBodyHtml = new StringBuilder();

            try
            {
                strBodyHtml.Append("<span style='PADDING-RIGHT: 0px;PADDING-LEFT: 0px;FONT-SIZE: 11px;PADDING-BOTTOM: 0px;MARGIN: 0px;COLOR: #333333;PADDING-TOP: 0px;BACKGROUND-REPEAT: repeat-x;FONT-FAMILY: Arial, Helvetica, sans-serif;TEXT-ALIGN: left'>");
                strBodyHtml.Append("<p>&nbsp;<br><br></p>");
                strBodyHtml.Append("<span style='font-size:16px;font-family:Verdana;color:red'><b>Assunto: " + model.subject + ".</b></span>");
                strBodyHtml.Append("<br><br><br>");
                strBodyHtml.Append("<span style='font-size:13px;font-family:Verdana;color:blue'><b>Dados do E-mail:</b></span>");
                strBodyHtml.Append("<br><br>");
                strBodyHtml.Append("<span style='font-size:10px;font-family:Verdana;color:black'><b>Nome:</b>&nbsp;&nbsp;" + model.name + "</span>");
                strBodyHtml.Append("<br>");
                strBodyHtml.Append("<span style='font-size:10px;font-family:Verdana;color:black'><b>E-mail:</b>&nbsp;&nbsp;" + model.Email + "</span>");
                strBodyHtml.Append("<br><br>");
                strBodyHtml.Append("<span style='font-size:10px;font-family:Verdana;color:blue'><b>Comentário:</b>&nbsp;&nbsp;" + model.message + "</span>");
                strBodyHtml.Append("</span>");

                return(strBodyHtml.ToString());
            }
            catch
            {
                return(String.Empty);
            }
            finally
            {
                strBodyHtml = null;
            }
        }
Exemplo n.º 4
0
        public EmptyResult CreateContact(ContactUsViewModel contactUsViewModel)
        {
            ContactUs contactUs = contactUsService.PopulateModel(contactUsViewModel);

            contactUsRepository.Save(contactUs);
            return(new EmptyResult());
        }
        public ActionResult ContactUs(ContactUsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Message = "ModeState is invalid";
                return(View(model));
            }

            systemEmail objEmail = new systemEmail();

            try
            {
                objEmail.SendEmail(getBodyHtml(model), model.Email, "CONTACT-US", model.subject);

                ViewBag.Message = "success";

                return(View());
            }
            catch (Exception ex)
            {
                ViewBag.Message = "error: " + ex.Message;
                return(View());
            }
            finally
            {
                objEmail = null;
            }
        }
Exemplo n.º 6
0
        public async Task <ActionResult> ContactUs(ContactUsViewModel model)
        {
            if (ModelState.IsValid)
            {
                IdentityMessage message = new IdentityMessage
                {
                    Destination = model.Email,

                    Body    = model.MessageBody,
                    Subject = model.MessageSubject
                };
                try
                {
                    // Create a Web transport for sending email.
                    var apiKey  = ConfigurationManager.AppSettings["SENDGRID_KEY"];
                    var client  = new SendGridClient(apiKey);
                    var to      = new EmailAddress("*****@*****.**", "PlayerUp");
                    var subject = message.Subject;

                    var from             = new EmailAddress(message.Destination);
                    var plainTextContent = message.Body;
                    var htmlContent      = message.Body;
                    var msg      = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
                    var response = await client.SendEmailAsync(msg);
                }
                catch (Exception)
                {
                }
                return(View("MessageSendSuccess"));
            }
            return(HttpNotFound());
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Contact(ContactUsViewModel model)
        {
            if (ModelState.IsValid)
            {
                await _emailSender.ContactEmail(model.Email, model.Name, model.Subject, model.Message);

                _notification.AddToastNotification("Message Sent Successfully",
                                                   NotificationHelper.NotificationType.success, new ToastNotificationOption
                {
                    NewestOnTop       = true,
                    CloseButton       = true,
                    PositionClass     = "toast-bottom-right",
                    PreventDuplicates = true
                });
                return(View());
            }
            _notification.AddToastNotification("You Have Made Errors",
                                               NotificationHelper.NotificationType.error, new ToastNotificationOption
            {
                NewestOnTop       = true,
                CloseButton       = true,
                PositionClass     = "toast-bottom-right",
                PreventDuplicates = true
            });
            return(View(model));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> ContactUs(ContactUsViewModel model)
        {
            #region reCaptcha
            var captchaResponse = await SecurityExtensions.ValidateRecaptcha <RecaptchaResponseModel>(Request,
                                                                                                      Configuration.GetValue <string>("recpatchaSecretKey:secretkey"));

            if (!captchaResponse.Success)
            {
                ModelState.AddModelError("recaptchaerror", "reCAPTCHA Error occured. Please try again");
                _toastNotification.AddWarningToastMessage("please do reCaptcha ");
                return(View(new ContactUsViewModel()
                {
                    CaptchaSitekey = Configuration.GetValue <string>("recpatchaSecretKey:sitekey")
                }));
            }
            #endregion

            await _uow.CustomLogService.Add(new CustomLogViewModel()
            {
                LogType  = "ContactUs",
                Message1 = model.SubjectId.ToString(),
                Message2 = model.Message
            });

            return(View(new ContactUsViewModel()
            {
                CaptchaSitekey = Configuration.GetValue <string>("recpatchaSecretKey:sitekey")
            }));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Uses the <see cref="EmailBuildHandler"/> and <see cref="EmailSender"/> to submit user's question/comment email
        /// </summary>
        /// <remarks>
        /// User provides a message along with a contact type meant only for organization as the type doesn't change anything about the process
        /// </remarks>
        /// <param name="form">A <see cref="ContactUsViewModel"/> object populated with relevant user contact information</param>
        /// <returns>The ConfirmContact ViewComponent</returns>
        public async Task <IActionResult> ConfirmContact([Bind("UserEmail,ContactType,Message")] ContactUsViewModel form)
        {
            if (!ModelState.IsValid)
            {
                return(ViewComponent("ContactUs", form));
            }
            else
            {
                string userID = User.FindFirstValue(ClaimTypes.NameIdentifier);

                var targetUser = _context.Users
                                 .Where(u => u.Id == userID)
                                 .FirstOrDefault();

                EmailBuildHandler ebh = new EmailBuildHandler();

                string finalEmail = ebh.BuildContactUsEmailHtml(targetUser.Name, form.UserEmail, form.ContactType, form.Message);

                string contentString = "User " + form.ContactType;

                await _emailSender.SendEmailAsync(form.UserEmail, contentString, finalEmail);

                return(ViewComponent("ConfirmContact"));
            }
        }
Exemplo n.º 10
0
        // GET: ContactUs
        public ActionResult Index()
        {
            DAL.DAL            dal = new DAL.DAL();
            ContactUsViewModel cvm = new ContactUsViewModel();

            cvm.DepositModelList    = dal.GetLatestDeposits();
            cvm.WithdrawalModelList = dal.GetLatestWithdrawals();

            ViewBag.TogelText  = dal.GetContentsByType(ContentType.TOGELTEXT).Contents;
            ViewBag.TogelDate  = dal.GetContentsByType(ContentType.TOGELDATE).Contents;
            ViewBag.TogelTime  = dal.GetContentsByType(ContentType.TOGELTIME).Contents;
            ViewBag.TogelTitle = dal.GetContentsByType(ContentType.TOGELTITLE).Contents;

            ContentManagementController cmc = new ContentManagementController();

            ViewBag.Contents  = cmc.GetContentsByType(ContentType.CONTACTUSTEXT).Contents;
            ViewBag.LiveChat  = cmc.GetContentsByType(ContentType.CONTACTUSLIVECHATTEXT).Contents;
            ViewBag.YahooMail = cmc.GetContentsByType(ContentType.CONTACTUSYAHOOMAILTEXT).Contents;
            ViewBag.Bbm       = cmc.GetContentsByType(ContentType.CONTACTUSBBMTEXT).Contents;
            ViewBag.Line      = cmc.GetContentsByType(ContentType.CONTACTUSLINETEXT).Contents;
            ViewBag.WeChat    = cmc.GetContentsByType(ContentType.CONTACTUSWECHATTEXT).Contents;
            ViewBag.WhatsApp  = cmc.GetContentsByType(ContentType.CONTACTUSWHATSAPPTEXT).Contents;

            return(View(cvm));
        }
Exemplo n.º 11
0
        public ActionResult Contact(ContactUsViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectWithViewModel(viewModel, "contact"));
            }

            var emailInfo = new NonTemplatedEmailInfo
            {
                To      = _configuration.AdministratorsEmail,
                Subject = "Errordite: Contact Us",
                Body    =
                    @"Message from: '{0}'<br />
                        <!--Contact Reason: '{1}'<br />-->
                        Email Address: '{2}'<br /><br />
                        Message: {3}"
                    .FormatWith(viewModel.Name, viewModel.Reason, viewModel.Email, viewModel.Message)
            };

            Core.Session.AddCommitAction(new SendMessageCommitAction(emailInfo, _configuration.GetNotificationsQueueAddress()));
            Core.Session.AddCommitAction(new SendMessageCommitAction(new ContactUsEmailInfo
            {
                To = viewModel.Email,
            }, _configuration.GetNotificationsQueueAddress()));

            ConfirmationNotification(Resources.Home.MessageReceived);
            return(RedirectToAction("contact"));
        }
Exemplo n.º 12
0
 public ContactUsPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     contactVM      = new ContactUsViewModel(Navigation);
     BindingContext = contactVM;
 }
Exemplo n.º 13
0
        public async Task <ActionResult> Submit(ContactUsViewModel modal)
        {
            HttpResponseMessage response = null;

            using (var client = new HttpClient())
            {
                var     url     = "https://api.gomoblin.co.il/api/Submited";
                JObject jObject = new JObject
                {
                    { "Id", Guid.NewGuid() },
                    { "SessionId", Guid.NewGuid() },
                    { "CampaignId", "70b3e027-660b-49dc-8403-2bfd41db2325" },
                    { "Email", modal.Email },
                    { "FullName", modal.FullName },
                    { "PhoneNumber", modal.PhoneNumber }
                };
                response = await client.PostAsync(url, new StringContent(jObject.ToString(), Encoding.UTF8, "application/json"));

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    return(Json(HttpStatusCode.OK, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(HttpStatusCode.OK, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> ContactUs(ContactUsViewModel model)
        {
            var localUrl = Url.Action(nameof(Index), controller: null, values: null, protocol: null, host: null, fragment: "contact");

            if (!ModelState.IsValid)
            {
                StatusMessage = "Error: " + String.Join(Environment.NewLine, ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)));
                return(new LocalRedirectResult(localUrl));
            }

            var message = $@"
-Contact Info-
Name: {model.Name}
Email: {model.Email}
Phone Number: {model.PhoneNumber}

-Email-
Subject: {model.Subject}
Message: {model.Message}
";

            var emailAddressValue = _db.ConfigurationValues.FirstOrDefault(configValue => configValue.Key == ConfigurationValueKeys.SystemEmailAddress);

            if (emailAddressValue == null)
            {
                throw new ApplicationException($"No ConfigurationValue configured with Key '{ConfigurationValueKeys.SystemEmailAddress}'");
            }
            await _emailSender.SendEmailAsync(emailAddressValue.Value, "Contact Us Message", message);

            StatusMessage = "Email sent successfully!";
            return(new LocalRedirectResult(localUrl));
        }
Exemplo n.º 15
0
        public IActionResult About()
        {
            var obj = new ResponseVM();
            AboutUsViewModel   modeAbout = UnitOfWork.AboutUsService.Get();
            ContactUsViewModel mode      = UnitOfWork.ContactUsService.Get();
            var about = new AboutUsViewModel()
            {
                Name = Language == Language.English ? modeAbout.editor1 : modeAbout.editor2
            };
            var cont = new ContactUsViewModel()
            {
                Id          = mode.Id,
                Email       = mode.Email,
                Facebook    = mode.Facebook,
                Phone       = mode.Phone,
                Twitter     = mode.Twitter,
                Website     = mode.Website,
                Google      = mode.Google,
                Instgram    = mode.Instgram,
                linkedin    = mode.linkedin,
                PhoneNumber = mode.PhoneNumber,
                Whatsapp    = mode.Whatsapp,
                YouTube     = mode.YouTube,
                Address     = mode.Address,
            };

            obj.DataAbout   = about.Name;
            obj.DataContact = cont;
            return(Ok(obj));
        }
Exemplo n.º 16
0
        public async Task <Result <bool> > ContactUs(int userId, ContactUsViewModel contactUs)
        {
            try
            {
                var body = File.ReadAllText("wwwroot/html/contactus.html");
                body = body.Replace("{user-email}", contactUs.Email);
                body = body.Replace("{user-id}", userId.ToString());
                body = body.Replace("{user-message}", contactUs.Message);

                await _mailProvider.SendAsync(new MailMessageViewModel
                {
                    From       = contactUs.Email,
                    To         = MailProvider.SMTP_USER,
                    Subject    = contactUs.Subject,
                    Body       = body,
                    IsBodyHtml = true
                });

                return(ResultHelper.Succeeded(true));
            }
            catch (Exception e)
            {
                return(ResultHelper.Failed <bool>(message: e.Message));
            }
        }
Exemplo n.º 17
0
        public IActionResult ContactUs()
        {
            var obj = new ResponseVM();
            ContactUsViewModel mode = UnitOfWork.ContactUsService.Get();

            if (mode == null)
            {
                obj.IsSucess = false;
                return(Ok(obj.IsSucess));
            }
            var cont = new ContactUsViewModel()
            {
                Id            = mode.Id,
                BankAccount   = mode.BankAccount,
                BanckAccount2 = mode.BanckAccount2,
                Email         = mode.Email,
                Facebook      = mode.Facebook,
                Phone         = mode.Phone,
                Twitter       = mode.Twitter,
                Website       = mode.Website,
                Google        = mode.Google,
                Instgram      = mode.Instgram,
                linkedin      = mode.linkedin,
                PhoneNumber   = mode.PhoneNumber,
                Whatsapp      = mode.Whatsapp,
                YouTube       = mode.YouTube,
                Address       = mode.Address,
            };

            obj.Data     = cont;
            obj.IsSucess = true;
            return(Ok(obj));
        }
Exemplo n.º 18
0
        public async Task <IActionResult> ContactUs([FromBody] ContactUsViewModel viewmodel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("/", "HomeController"));
            }

            var createdContactRecord = await this.contactUsService.CreateContactAsync(viewmodel);

            if (createdContactRecord is null)
            {
                return(this.Ok(createdContactRecord));
            }
            //create newCOntact.If success
            //contactUsService.CreateContact()

            //send email to Admin and Customer as confirmation


            //return this.CreatedAtRoute("GetBook", new { id = book.Id }, book);?????

            //EmailService.SendEmail()

            //save to db incomming data
            return(RedirectToAction("/", "HomeController"));
        }
Exemplo n.º 19
0
        /// <summary>
        /// Sends the support email to the app admin.
        /// Emails are sent to support emails defined in the settings.
        /// </summary>
        /// <param name="user">The user <see cref="AppUser"/></param>
        /// <param name="model"><see cref="ContactUsViewModel"/></param>
        /// <returns></returns>
        public async Task <bool> SendSupportEmailAsync(AppUser user, ContactUsViewModel model)
        {
            try
            {
                string msg = model.Message.Replace("\r\n", "<br/>") + "<br/><hr/>" + GetCurrentContextInHtml(user);
                _Emailer.AddTo(_Settings.GetAppSupportEmailAddress());
                _Emailer.SetFromAddress(_Settings.GetShopifyFromEmailAddress());
                var _msg = $"<h3>{model.Name} wrote</h3><br/><hr/>{msg}<br/><hr>";
                _Emailer.SetMessage(_msg, true);
                _Emailer.SetSubject($"☎ {model.Subject} | {model.ShopDomain} | {model.Name}");
                var result = await _Emailer.Send(true);

                if (result)
                {
                    _Logger.LogInformation("Sending user support email was successful.");
                }
                else
                {
                    _Logger.LogInformation("Sending user support email was unsuccessful.");
                }
                return(result);
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex, $"Error sending support email.{ex.Message}");
                return(false);
            }
        }
Exemplo n.º 20
0
        public IActionResult Create(ContactUsViewModel vm)
        {
            var result = _ContactUsRepository.Create(vm);

            TempData.AddResult(result);
            return(View(nameof(Index)));
        }
Exemplo n.º 21
0
        public ActionResult Contact(ContactUsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.SubmitEmailSent = false;
                return(View("AboutUs"));
            }

            // Send email to Scrum Lords for approval
            var email = new MailMessage();

            email.To.Add(_gmailer.GetEmailAddress());
            email.From       = new MailAddress(model.Email);
            email.Subject    = $"Support inquiry received from {model.Name}.";
            email.Body       = $"Received following inquiry from {model.Name}, email address {model.Email}: " + model.Message;
            email.IsBodyHtml = true;

            // Send email and return to view if successful
            if (_gmailer.Send(email))
            {
                ViewBag.SubmitEmailSent = true;
                return(View("AboutUs", model));
            }

            // Email could not be sent, display error
            ViewBag.SubmitEmailSent = false;
            ViewData.ModelState.AddModelError("EmailError", "Unfortunately, your email could not be sent.");
            return(View("AboutUs", model));
        }
Exemplo n.º 22
0
        public IActionResult ContactUs(ContactUsViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                var body = $"<p><b>Name</b> = {model.Name} </p>" +
                           $"<p><b>Phone Number</b> = {model.PhoneNumber} </p>" +
                           $"<p><b>Content</b> = {model.Text} </p>";

                _emailSender.Send("*****@*****.**", "zodiac contact", body);

                TempData["Message"] = "Message has been successfully send";
            }
            catch (Exception exception)
            {
                _logger.LogError(exception, "an error occured while sending a mail");

                TempData["Message"] = "an error occured while sending your message";
            }

            return(RedirectToAction("ContactUs"));
        }
        public ActionResult Index(ContactUsViewModel model)
        {
            var customer = HttpContext.GetCustomer();

            if (CaptchaSettings.CaptchaIsConfigured() &&
                CaptchaSettings.RequireCaptchaOnContactForm)
            {
                var captchaResult = CaptchaVerificationProvider.ValidateCaptchaResponse(Request.Form[CaptchaVerificationProvider.RecaptchaFormKey], customer.LastIPAddress);

                if (!captchaResult.Success)
                {
                    NoticeProvider.PushNotice(captchaResult.Error.Message, NoticeType.Failure);

                    // This error isn't actually displayed; it is just used to trigger the persisting of form data for the next page load
                    ModelState.AddModelError(
                        key: CaptchaVerificationProvider.RecaptchaFormKey,
                        errorMessage: "Captcha Failed");

                    return(RedirectToAction(ActionNames.Index));
                }
            }

            AppLogic.SendMail(subject: model.Subject,
                              body: GetContactTopic(model),
                              useHtml: true,
                              fromAddress: Settings.FromAddress,
                              fromName: Settings.FromName,
                              toAddress: Settings.ToAddress,
                              toName: Settings.ToName,
                              bccAddresses: string.Empty,
                              server: Settings.MailServer);

            return(RedirectToAction(ActionNames.Detail, ControllerNames.Topic, new { name = "ContactUsSuccessful" }));
        }
Exemplo n.º 24
0
        public async Task <ActionResult> Contact(ContactUsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            try
            {
                model.Mobile = string.IsNullOrEmpty(model.Mobile) ? " - " : model.Mobile;
                var _subject = "Contact mail from " + model.FirstName + " " + model.LastName + " | instanttutors.org";
                var _body    = "Mail from " + model.FirstName + " " + model.LastName + ",<br/><br/>"
                               + "<b>Email Address:</b> " + model.Email + "<br/>"
                               + "<b>Mobile:</b> " + model.Mobile + "<br/>"
                               + "<b>Comment:</b> " + model.Comment + "<br/><br/>"
                               + "<a href='http://instanttutors.org/' target='_blank'>Instant Tutors</a> @ " + DateTime.Now.Year;

                await EmailSender.SendEmailAsync(_subject, _body);

                ModelState.Clear();
                ViewBag.success = "<ul><li><p style='color:green'>Email has been sent. Thanks for contacting us.</p></li></ul>";
            }
            catch (Exception ex)
            {
                ViewBag.success = "<ul><li><p style='color:red'>ERROR: " + ex.Message + "</p><input type='hidden' value='" + ex + "'/></li></ul>";
            }
            return(View());
        }
Exemplo n.º 25
0
        public JsonResult GetContactData()
        {
            var data     = _contactUSRepository.Get();
            var newItems = new List <ContactUsViewModel>();

            foreach (var item in data)
            {
                var newItem = new ContactUsViewModel()
                {
                    CreationDate = item.CreationDate.ToShortDateString(),
                    Address      = item.Address,
                    City         = item.City,
                    Email        = item.Email,
                    FirstName    = item.FirstName,
                    Id           = item.Id,
                    Message      = item.Message,
                    PhoneNumber  = item.PhoneNumber,
                    PostalNumber = item.PostalNumber,
                    Region       = item.Region,
                    SecondName   = item.SecondName,
                    Topic        = item.Topic,
                };

                newItems.Add(newItem);
            }
            return(Json(new { data = newItems }));
        }
Exemplo n.º 26
0
        public ActionResult Contactus()
        {
            // if  is logged iusern and logged in user is not member then redirect to admin dashboard
            if (User.Identity.IsAuthenticated)
            {
                var user = context.Users.Where(x => x.EmailID == User.Identity.Name).FirstOrDefault();
                if (user.RoleID != context.UserRoles.Where(x => x.Name.ToLower() == "member").Select(x => x.ID).FirstOrDefault())
                {
                    return(RedirectToAction("Dashboard", "Admin"));
                }
            }

            // viewbag for active class in navigation
            ViewBag.Contactus = "active";
            // check if user is authenticated then we need to show full name and email
            if (User.Identity.IsAuthenticated)
            {
                // if user is authenticated then get user
                var user = context.Users.Where(x => x.EmailID == User.Identity.Name).FirstOrDefault();
                // create contact us viewmodel
                ContactUsViewModel viewmodel = new ContactUsViewModel();

                viewmodel.FullName = user.FirstName + " " + user.LastName;
                viewmodel.EmailID  = user.EmailID;
                // return viewmodel
                return(View(viewmodel));
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 27
0
        public ActionResult ContactUs(ContactUsViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }
            using (var client = new SmtpClient())
            {
                var message = new MailMessage();
                message.To.Add(new MailAddress("*****@*****.**", "Itay Sagui"));
                message.To.Add(new MailAddress("*****@*****.**", "Ariel Ornstein"));

                message.Body    = string.Format("Name : {0} <{1}>\r\n\t\n{2}", viewModel.Name, viewModel.Email, viewModel.Message);
                message.Subject = "WinApps: " + viewModel.Subject;

                try
                {
                    client.Send(message);
                }
                catch (Exception)
                {
                }
            }

            return(View());
        }
Exemplo n.º 28
0
        public ActionResult ContactUs(ContactUsViewModel model)
        {
            var encodedResponse = Request.Form[RecaptchaResult.ResponseFormVariable];
            var isCaptchaValid  = _recaptchaService.Validate(encodedResponse);

            if (!isCaptchaValid)
            {
                ModelState.AddModelError("", Dictionary.InvalidRecaptcha);
                return(View("ContactUs", model));
            }

            try
            {
                _mailer.SendEmail(
                    model.Subject,
                    model.Body,
                    _config.SupportEmailAddress,
                    _config.CompanyName,
                    model.EmailAddress,
                    model.Name);

                var contact = _contactService.GetOrCreateContact("", model.Name, model.EmailAddress);
                SendEmailToCustomer(contact);

                return(RedirectToAction("ContactUsSuccess"));
            }
            catch (Exception ex)
            {
                _logger.Error(ex.GetFullErrorMessage());
                return(View("FriendlyError"));
            }
        }
Exemplo n.º 29
0
        // GET: ContactUs
        public virtual ActionResult Index()
        {
            ContactUsViewModel contactUsViewModel = new ContactUsViewModel();

            ViewBag.State = false;
            return(View(contactUsViewModel));
        }
Exemplo n.º 30
0
        public ActionResult Index(ContactUsViewModel model)
        {
            if (!IsCaptchaValid(model.CaptchaCode))
            {
                CaptchaStorageService.ClearSecurityCode(HttpContext);
                ModelState.AddModelError("CaptchaCode", "The letters you entered did not match, please try again.");
            }

            if (!ModelState.IsValid)
            {
                return(RedirectToAction(ActionNames.Index));
            }

            AppLogic.SendMail(subject: model.Subject,
                              body: GetContactTopic(model),
                              useHtml: true,
                              fromAddress: AppLogic.AppConfig("GotOrderEMailFrom"),
                              fromName: AppLogic.AppConfig("GotOrderEMailFromName"),
                              toAddress: AppLogic.AppConfig("GotOrderEMailTo"),
                              toName: AppLogic.AppConfig("GotOrderEMailTo"),
                              bccAddresses: string.Empty,
                              server: AppLogic.MailServer());

            // Clear the captcha so additional requests use a different security code.
            CaptchaStorageService.ClearSecurityCode(HttpContext);

            return(RedirectToAction(ActionNames.Detail, ControllerNames.Topic, new { name = "ContactUsSuccessful" }));
        }
Exemplo n.º 31
0
        public static void ClearContactUs()
        {
            if (_designer == null) { return; }

            _contactUs.Cleanup();
            _contactUs = null;
        }
Exemplo n.º 32
0
 public static void CreateContactUs()
 {
     if (_contactUs == null)
     {
         _contactUs = new ContactUsViewModel();
     }
 }