Exemple #1
0
        public ActionResult Nouvelle(PrestationVM vm)
        {
            if (!ModelState.IsValid)
            {
                return(View("Erreur"));
            }

            PrestationDAO.Persist(vm.Entity, vm.PoleId, vm.Joins);

            return(View(vm));
        }
        private ActiviteVM createViewData(int?prestationId, int?poleId)
        {
            var prestationIdOrDefault = prestationId.GetValueOrDefault(PrestationDAO.First().ID);

            var poleIdOrDefault = poleId.GetValueOrDefault(PoleDAO.WherePrestation(prestationIdOrDefault).ID);

            var vm = new ActiviteVM()
            {
                Entity = new Activite()
                {
                    PrestationID = prestationIdOrDefault
                }, PoleId = poleIdOrDefault
            };

            setPrestationDropDown(vm.PoleId, prestationIdOrNull: prestationId);
            setPoleDropDown(vm.PoleId);
            setCheckboxes(vm, prestationId.GetValueOrDefault());
            return(vm);
        }