Exemplo n.º 1
0
        public async Task <ActionResult> Index(Socioboard.Helper.Enterprise ent)
        {
            RecaptchaVerificationHelper recaptchaHelper = this.GetRecaptchaVerificationHelper();

            string ret;

            if (String.IsNullOrEmpty(recaptchaHelper.Response))
            {
                ModelState.AddModelError("", "Captcha answer cannot be empty.");
                //return View(model);
                return(View());
            }

            RecaptchaVerificationResult recaptchaResult = await recaptchaHelper.VerifyRecaptchaResponseTaskAsync();

            if (recaptchaResult != RecaptchaVerificationResult.Success)
            {
                ModelState.AddModelError("", "Incorrect captcha answer.");
                ViewBag.AlertMsg = "error";
                return(RedirectToAction("Enterprise", "Versions", new { hint = "error" }));
            }
            else
            {
                Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
                ret = ApiobjMailSender.SendEnterpriseMail(ent.Name, ent.Designation, ent.ContactEmailId, ent.Location, ent.Company, ent.CompanyWebsite, ent.Message, ent.Phone);

                return(RedirectToAction("Enterprise", "Versions", new { hint = "success" }));
                //return Content(ret);
                //return View();
            }


            // return View(model);
            //return View();
        }
Exemplo n.º 2
0
        //[RecaptchaControlMvc.CaptchaValidator]
        //[HttpPost]
        public ActionResult SendEnterpriseMail(string name, string designation, string email, string location, string company, string companywebsite, string messages, string Phone, string captchaErrorMessage, string recaptcha_challenge_field, string recaptcha_response_field)
        {
            bool   isCaptchaCodeValid = false;
            string mailsender         = string.Empty;
            string CaptchaMessage     = "";

            isCaptchaCodeValid = GetCaptchaResponse(out CaptchaMessage, recaptcha_challenge_field, recaptcha_response_field);
            //return RedirectToAction("success");

            if (isCaptchaCodeValid)
            {
                Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
                mailsender = ApiobjMailSender.SendEnterpriseMail(name, designation, email, location, company, companywebsite, messages, Phone);
            }
            else
            {
                mailsender = "Invalid Captcha";
            }
            return(Content(mailsender));
        }
        public async Task<ActionResult> Index(Socioboard.Helper.Enterprise ent)
        {

            RecaptchaVerificationHelper recaptchaHelper = this.GetRecaptchaVerificationHelper();

            string ret;
            if (String.IsNullOrEmpty(recaptchaHelper.Response))
            {
                ModelState.AddModelError("", "Captcha answer cannot be empty.");
                //return View(model);
                return View();
            }

            RecaptchaVerificationResult recaptchaResult = await recaptchaHelper.VerifyRecaptchaResponseTaskAsync();

            if (recaptchaResult != RecaptchaVerificationResult.Success)
            {
                ModelState.AddModelError("", "Incorrect captcha answer.");
                ViewBag.AlertMsg = "error";
                return RedirectToAction("Enterprise", "Versions", new { hint = "error" });

            }
            else
            {
                Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
                ret = ApiobjMailSender.SendEnterpriseMail(ent.Name, ent.Designation, ent.ContactEmailId, ent.Location, ent.Company, ent.CompanyWebsite, ent.Message, ent.Phone);

                return RedirectToAction("Enterprise", "Versions", new { hint = "success" });
                //return Content(ret);
                //return View();
            }


            // return View(model);
            //return View();
        }
        //[RecaptchaControlMvc.CaptchaValidator]
        //[HttpPost]
        public ActionResult SendEnterpriseMail(string name, string designation, string email, string location, string company, string companywebsite, string messages, string Phone, string captchaErrorMessage, string recaptcha_challenge_field, string recaptcha_response_field)
        {
            bool isCaptchaCodeValid = false;
            string mailsender = string.Empty;
            string CaptchaMessage = "";
            isCaptchaCodeValid = GetCaptchaResponse(out CaptchaMessage, recaptcha_challenge_field, recaptcha_response_field);
            //return RedirectToAction("success");

            if (isCaptchaCodeValid)
            {
                Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender();
                mailsender = ApiobjMailSender.SendEnterpriseMail(name, designation, email, location, company, companywebsite, messages, Phone);
               
            }
            else
            {
                mailsender = "Invalid Captcha";
            }
            return Content(mailsender);
        }