Example #1
0
        public ActionResult Brokeri()
        {
            log.Info($"Browser: {Request.Browser.Browser}, Version: {Request.Browser.Version}, UserAgent: {Request.UserAgent}");

            BrokerVM mirVM = new BrokerVM();

            return(View(mirVM));
        }
Example #2
0
        public ViewResult AllBrokers()
        {
            /*Call the GetToday method of the helper class to get and set today's date for use with datepicker validation*/
            Helper.GetToday();

            var criticalVB = taskRepo.GetAllTasksByType("Alert").Where(t => t.Priority == 5).ToList();

            foreach (KWTask task in taskRepo.GetAllTasksByType("Task").Where(t => t.Priority == 5).ToList())
            {
                criticalVB.Add(task);
            }

            ViewBag.Critical = criticalVB;
            var vm = new BrokerVM();

            vm.Brokers   = brokerRepo.GetAllBrokers().ToList();
            vm.NewBroker = new Broker();
            return(View(vm));
        }
Example #3
0
        public JsonResult SaveFormData(BrokerVM BrokerVM)
        {
            //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["Broker"] = BrokerVM;

                var uploadPath = System.Configuration.ConfigurationManager.AppSettings["OnLinePrijaveUploadFolder"];

                var folderName     = BrokerVM.VrijemePrijave + "_" + BrokerVM.Ime + "_" + BrokerVM.Prezime + '_' + BrokerVM.SifraKandidata + "_" + "Broker";
                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 }));
            }
        }