public ActionResult AddSalon() { if (adminFranchise.IsNull()) { return RedirectError(); } if (TempData["Error"].IsNotNull()) ViewBag.Error = TempData["Error"]; if (TempData["Success"].IsNotNull()) ViewBag.Success = TempData["Success"]; var model = new ViewModelAddSalon { Form = new ViewModelFormAddSalon { JourOuvertures = Bdd.GetDisponibiliteInit() }, IsAutorized = Bdd.AutorizedAddSalon(adminFranchise) }; return View(model); }
public ActionResult AddSalon(ViewModelAddSalon model) { if (ModelState.IsValid) { if (adminFranchise.IsNull()) { return RedirectError(); } //Ajout du salon //if (Bdd.AddSalon(model)) //{ // TempData["Success"] = "Le salon a bien été ajouté"; //} //else //{ // TempData["Error"] = "Erreur lors de l'ajout du salon"; //} //On redirige sur la page du salon return RedirectToRoute("Backend_franchise_addsalon"); } model.Form = new ViewModelFormAddSalon { JourOuvertures = Bdd.GetDisponibiliteInit() }; model.IsAutorized = Bdd.AutorizedAddSalon(adminFranchise); return View(model); }