ASTE.Modules.FormModule.Controllers.apiController.Form C# (CSharp) Méthode

Form() private méthode

private Form ( List answers ) : string
answers List
Résultat string
        public string Form(List<FormAnswer> answers)
        {
            FormModuleContext ctx = new FormModuleContext();
            if(answers != null && answers.Count > 0)
            {
                Form form = new Form();
                form.id = answers[0].form_id;
                var q_id = answers[0].form_question_metadata_id;
                var q = ctx.form_questions.Where(x => x.id == q_id ).FirstOrDefault();
                form.form_metadata_id = q.form_metadata_id;
                form.answers = answers;
                ctx.forms.Add(form);
                ctx.SaveChanges();

                return "{ \"form_id\" : " + form.id.ToString() + " }";
            }
            return null;
        }

Same methods

apiController::Form ( int id ) : string