public ActionResult MirovinskiFondovi() { log.Info($"Browser: {Request.Browser.Browser}, Version: {Request.Browser.Version}, UserAgent: {Request.UserAgent}"); MirovinskiFondVM mirVM = new MirovinskiFondVM(); return(View(mirVM)); }
public JsonResult SaveFormData(MirovinskiFondVM mirovinskiFondVM) { //Validate Google recaptcha here var response = Request["g-recaptcha-response"]; string secretKey = ConfigurationManager.AppSettings["GoogleReCaptchaSecretKey"]; var client = new WebClient(); var result = client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response)); var obj = JObject.Parse(result); var status = (bool)obj.SelectToken("success"); if ((!ModelState.IsValid) || !status) { if (!status) { ModelState.AddModelError("GoogleReCaptcha greška", "Google reCaptcha validacija nije uspjela"); } return(Json(new { status = false, errors = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList() }, JsonRequestBehavior.AllowGet)); } else { Session["MirovinskiFond"] = mirovinskiFondVM; var uploadPath = System.Configuration.ConfigurationManager.AppSettings["OnLinePrijaveUploadFolder"]; var folderName = mirovinskiFondVM.VrijemePrijave + "_" + mirovinskiFondVM.Ime + "_" + mirovinskiFondVM.Prezime + '_' + mirovinskiFondVM.SifraKandidata + "_" + "MirovinskiFond"; var fullUploadPath = uploadPath + folderName; bool exists = System.IO.Directory.Exists(fullUploadPath); if (!exists) { System.IO.Directory.CreateDirectory(fullUploadPath); } Session["FullUploadPath"] = fullUploadPath; return(Json(new { status = true })); } }