Example #1
0
 public ActionResult Edit([Bind(Include = "Id,Customer_Id_FK,Client_PID,Client_Fname,Client_MI,Client_Lname,Client_DOB,Client_Email,Client_Phone,Client_Q1,Client_Q2,Client_Q3,Client_Q4,Client_Q5,Client_Q6,Client_Q7,Client_Q8,Client_Q9,Client_Q10,Dt_Complete")] Vcall_Client vcall_Client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vcall_Client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vcall_Client));
 }
Example #2
0
        public ActionResult Create([Bind(Include = "Id,Customer_Id_FK,Client_PID,Client_Fname,Client_MI,Client_Lname,Client_DOB,Client_Email,Client_Phone, Client_Other_Pid")] Vcall_Client vcall_Client)
        {
            try

            {
                var status = true;
                //Captcha!_____________________________________________
                string Robot = Request.Cookies["customer_robot"].Value;
                if (Robot == "1")
                {
                    var    recaptcha = Request["g-recaptcha-response"];
                    string secretKey = "6Ldu6jIUAAAAAMef2oKOODA7lZYGdWT5KqJF1A5-";

                    var Client = new WebClient();
                    var result = Client.DownloadString(string.Format("Https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, recaptcha));
                    var obj    = JObject.Parse(result);
                    status = (bool)obj.SelectToken("success");
                }

                if (status == false)
                {
                    ViewBag.Captcha = "Please verify you are not a robot!";
                    return(View());
                }

                //End captcha_____________________________________________


                else if (ModelState.IsValid)
                {
                    db.Vcall_Client.Add(vcall_Client);
                    vcall_Client.Customer_Id_FK = Int32.Parse(Request.Cookies["Cust_id_Fk"].Value);
                    db.SaveChanges();
                    System.Web.HttpContext.Current.Session["Personid"] = vcall_Client.Id.ToString();
                    SaveIp();
                    return(RedirectToAction("Questions"));
                }
                else
                {
                    return(RedirectToAction("Errors"));
                }
            }
            catch (Exception ex)
            {
                writelog(ex.ToString());
                return(RedirectToAction("Errors"));
            }
        }