Пример #1
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")
            }));
        }