コード例 #1
0
        public ActionResult saveSurveyForm(string id)
        {
            string fieldNames = "Reference_Number";
            string values = "'" + id + "'";
            string setString = "Reference_Number='" + id + "'";
            SurveyEntities _dbContext = new SurveyEntities();
            foreach (string key in Request.Form.Keys)
            {

                fieldNames += "," + key;
                values += "," + "'" + Request.Form[key] + "'";
                setString += "," + key + "='" + Request.Form[key] + "'";
            }
            var data = _dbContext.submitFormData(id, "", fieldNames, values, setString);

            return RedirectToAction("TeamLeadListing");
        }
コード例 #2
0
        public ActionResult submitSurveyForm(string id)
        {
            string fieldNames = "Reference_Number";
            string values = "'" + id + "'";
            string setString = "Reference_Number='" + id + "'";
            SurveyEntities _dbContext = new SurveyEntities();

            foreach (string key in Request.Form.Keys)
            {

                fieldNames += "," + key;
                values += "," + "'" + Request.Form[key] + "'";
                setString += "," + key + "='" + Request.Form[key] + "'";
            }
            var data = _dbContext.submitFormData(id, "", fieldNames, values, setString);

            if (Request.Files.Count > 0)
            {

                for (int i = 0; i < Request.Files.Count; i++)
                {
                    var postedFile = Request.Files[i];
                    if (String.IsNullOrEmpty(postedFile.FileName)) continue;
                    string folderpath = Server.MapPath("~/Images/SurveyForms/" + id.ToString());
                    if (!Directory.Exists(folderpath))
                    {
                        Directory.CreateDirectory(folderpath);
                    }
                    var filePath = folderpath + "/" + postedFile.FileName;

                    postedFile.SaveAs(filePath);
                }

            }
            return RedirectToAction("SurveyListing");
        }