private FormTypeMaterielViewModels GetFormTypeMateriel(bool isEdit, TypeMateriel unTypeMateriel = null) { FormTypeMaterielViewModels model = new FormTypeMaterielViewModels(); model.unTypeMateriel = unTypeMateriel; model.isEdit = isEdit; return(model); }
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)); }
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)); }
public ActionResult Create() { FormTypeMaterielViewModels formModel = this.GetFormTypeMateriel(false); return(View(formModel)); }