Пример #1
0
        private int CreateFormulier(string type, RapporteringsFormulierViewModel model)
        {
            var formulier = model.RapporteringsFormulier.ToModel <Formulier>();

            formulier.TypeRf       = type;
            formulier.CreatieDatum = DateTime.Now;
            ApplyChanges(model, formulier);

            var createdRf = FormulierRepository.Add(formulier);

            FormulierRepository.SaveChanges();

            logger.Info("User x created report form id " + createdRf.Id);

            return(createdRf.Id);
        }
Пример #2
0
        public void UpdateFormulier(RapporteringsFormulierViewModel model)
        {
            var originalRf = FormulierRepository.GetFirstOrDefault(f => f.Id == model.RapporteringsFormulier.Id);

            if (originalRf == null)
            {
                logger.Warn("Action: Update / Result: Id not found " + model.RapporteringsFormulier.Id);
                throw new HttpException(404, "Het gevraagde rapport werd niet gevonden");
            }
            logger.Info("User x updated report form id " + model.RapporteringsFormulier.Id);

            //originalRf = model.RapporteringsFormulier.ToModel<Formulier>(originalRf);


            ApplyChanges(model, originalRf);

            FormulierRepository.Update(originalRf);
            FormulierRepository.SaveChanges();
        }