Пример #1
0
        public ActionResult UpdateTypePrestations(ViewModelGererTypePrestations model, int? id)
        {
            if (AccessSalon(id).IsFalse() || model.IsNull())
            {
                return RedirectError();
            }

            if (ModelState.IsValid)
            {
                var reponse = Bdd.UpdateTypePrestationSalon(id, model.Form);
                switch (reponse)
                {
                    case 0:
                        TempData["Success"] = "Prestation bien modifiée";
                        break;
                    default:
                        TempData["Error"] = "Erreur lors de la modification de la prestation";
                        break;
                }
            }

            return RedirectToRoute("Backend_salon_gerertypeprestations", new { id = id });
        }
Пример #2
0
        public ActionResult GererTypePrestations(int? id)
        {
            if (AccessSalon(id).IsFalse())
            {
                return RedirectError();
            }

            var prestationsSalon = Bdd.GetPrestationsSalon(id);
            var prestations = Bdd.GetPrestations();

            if (TempData["Success"].IsNotNull())
                ViewBag.Success = TempData["Success"];
            if (TempData["Error"].IsNotNull())
                ViewBag.Error = TempData["Error"];

            var model = new ViewModelGererTypePrestations
            {
                Prestations = prestations,
                PrestationsSalon = prestationsSalon,
                Form = new ViewModelFormUpdateTypePrestation()
            };

            return View(model);
        }