Esempio n. 1
0
        public IntakeFormModel Create(IntakeFormModel intakeFormModel)
        {
            var intakeForm = new IntakeForm();

            intakeForm.MapFromModel(intakeFormModel);
            intakeForm.Status = IntakeFormStatus.New;

            _context.IntakeForm.Add(intakeForm);
            _context.SaveChanges();

            return(intakeForm.ToModel());
        }
Esempio n. 2
0
        public IntakeFormModel Update(IntakeFormModel intakeFormModel)
        {
            IntakeForm intakeForm = _context.IntakeForm
                                    .Include(i => i.Signatures)
                                    .Include("Questions.Answers")
                                    .First(u => u.IntakeFormId == intakeFormModel.IntakeFormId);

            intakeForm.MapFromModel(intakeFormModel);

            _context.SaveChanges();

            return(intakeForm.ToModel());
        }