예제 #1
0
        public void SubmitEval(EvalDTO eval)
        {
            var foundEval = _context.Evals.Find(eval.Id);

            if (foundEval != null)
            {
                throw new FaultException(eval.Id);
            }

            _context.Evals.Add(eval);
            _context.SaveChanges();
        }
예제 #2
0
            public static bool SaveForm(EvalFormJSModel model)
            {
                EvalContext context = new EvalContext();

                EvalForm form = new EvalForm()
                {
                    EvalFormId = Guid.NewGuid(),
                    Name       = model.Name
                };

                context.Forms.Add(form);

                if (model.Questions != null)
                {
                    foreach (var sq in model.Questions)
                    {
                        RecurrsiveSaveQuestion(context, sq, form, null);
                    }
                }
                context.SaveChanges();

                return(true);
            }
예제 #3
0
            public static bool SaveInstance(EvalFormVM model)
            {
                EvalContext context = new EvalContext();

                EvalInstance form = new EvalInstance()
                {
                    EvalInstanceId = Guid.NewGuid(),
                    DateCreated    = DateTime.UtcNow,
                    EvalFormId     = model.EvalFormId
                };

                context.Instances.Add(form);

                if (model.EvalQuestions != null)
                {
                    foreach (var sq in model.EvalQuestions)
                    {
                        RecurrsiveSaveQuestionAnswer(context, sq, form.EvalInstanceId);
                    }
                }
                context.SaveChanges();
                return(true);
            }