Example #1
0
        private FormTypeMaterielViewModels GetFormTypeMateriel(bool isEdit, TypeMateriel unTypeMateriel = null)
        {
            FormTypeMaterielViewModels model = new FormTypeMaterielViewModels();

            model.unTypeMateriel = unTypeMateriel;
            model.isEdit         = isEdit;
            return(model);
        }
Example #2
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                string ErrorMessage = "Id Type Materiel manquant";
                return(RedirectToAction("Index", new { MessageErreur = ErrorMessage }));
            }
            TypeMateriel unTypeMateriel = this.typeMaterielService.GetTypeMaterielById(id);

            if (unTypeMateriel == null)
            {
                return(HttpNotFound());
            }
            FormTypeMaterielViewModels formModel = this.GetFormTypeMateriel(true, unTypeMateriel);

            return(View(formModel));
        }
Example #3
0
        public ActionResult Create([Bind(Include = "ID,Nom,Domaine")] TypeMateriel unTypeMateriel)
        {
            FormTypeMaterielViewModels formModel = this.GetFormTypeMateriel(false, unTypeMateriel);

            if (ModelState.IsValid)
            {
                ActionControllerResult result = this.typeMaterielService.InsertTypeMateriel(unTypeMateriel, User.Identity.GetUserId());
                if (result == ActionControllerResult.FAILURE)
                {
                    ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS;
                    return(View(formModel));
                }
                this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.TypeMateriel, unTypeMateriel.ID, "Création d'un Type de Matériel", null, User.Identity.GetUserId());
                return(RedirectToAction("Index"));
            }
            return(View(formModel));
        }
Example #4
0
        public ActionResult Create()
        {
            FormTypeMaterielViewModels formModel = this.GetFormTypeMateriel(false);

            return(View(formModel));
        }