public ActionResult Index(SurveyResultsModel model) { if (model == null) { throw new ArgumentNullException("model"); } if (SurveyProvider.GetInvitationInfo(model.accesscode) == null) { ((dynamic) base.ViewBag).NotFound = true; } else { SurveyProvider.SetSurveyResult(model); ((dynamic) base.ViewBag).Thanks = true; } return base.View(); }
public static void SetSurveyResult(SurveyResultsModel survey) { if (survey == null) { throw new System.ArgumentNullException("survey"); } XName arg_C4_0 = "surveyResult"; object[] array = new object[2]; array[0] = ((survey.guest == null) ? null : new XElement("guest", new object[] { new XElement("name", survey.guest.name), new XElement("sex", survey.guest.sex) })); object[] arg_C2_0 = array; int arg_C2_1 = 1; System.Collections.Generic.IEnumerable<XElement> arg_C2_2; if (survey.questions != null) { arg_C2_2 = survey.questions.Select(delegate (System.Collections.Generic.KeyValuePair<string, SurveyQuestionModel> q) { XName arg_105_0 = "question"; object[] array2 = new object[4]; array2[0] = new XAttribute("id", q.Key); array2[1] = (string.IsNullOrEmpty(q.Value.issue) ? null : new XElement("issue", new XAttribute("id", q.Value.issue))); object[] arg_D4_0 = array2; int arg_D4_1 = 2; System.Collections.Generic.IEnumerable<XElement> arg_D4_2; if (q.Value.marks != null) { arg_D4_2 = from m in q.Value.marks where (m.Value ?? "").ToLower() == "on" select new XElement("issue", new XAttribute("id", m.Key)); } else { arg_D4_2 = null; } arg_D4_0[arg_D4_1] = arg_D4_2; array2[3] = ((q.Value.note == null) ? null : new XElement("note", q.Value.note)); return new XElement(arg_105_0, array2); }); } else { arg_C2_2 = null; } arg_C2_0[arg_C2_1] = arg_C2_2; XElement xml = new XElement(arg_C4_0, array); DataSet result = DatabaseOperationProvider.QueryProcedure("[rating].[up_setSurveyResult]", "result", new { accesscode = survey.accesscode, data = xml }); }