Ejemplo n.º 1
0
        public ActionResult DeleteExemplaire(Guid pCodeFilm, Guid pCodeProprietaire, String pCodeSupport, FormCollection collection)
        {
            if (Request.IsAuthenticated)
            {
                try
                {
                    GestionnaireFilms gestionnaireFilms = new GestionnaireFilms();
                    gestionnaireFilms.SupprimerExemplaire(pCodeFilm, pCodeProprietaire, pCodeSupport);

                    return RedirectToAction("Details", "Film", new { codeFilm = pCodeFilm });
                }
                catch (Exception ex)
                {
                    HandleErrorInfo error = new HandleErrorInfo(ex, "Film", "DeleteExemplaire");
                    return View("Error", error);
                }

            }
            else
            {
                return RedirectToAction("LogOn", "Account");
            }
        }
Ejemplo n.º 2
0
        public ActionResult DeleteExemplaire(Guid pCodeMedia, Guid pCodeExemplaire, FormCollection collection)
        {
            if (Request.IsAuthenticated)
            {
                try
                {
                    GestionnaireMedias gestionnaireMedias = new GestionnaireFilms();
                    gestionnaireMedias.SupprimerExemplaire(pCodeExemplaire);

                    Media m = gestionnaireMedias.ObtenirMedia(pCodeMedia);

                    switch (m.TypeMedia)
                    {
                        case MediaGestion.Modele.Constantes.EnumTypeMedia.TOUT:
                            throw new Exception("Cas non géré");
                        case MediaGestion.Modele.Constantes.EnumTypeMedia.FILM:
                            return RedirectToAction("Details", "Film", new { codeMedia = pCodeMedia });
                        case MediaGestion.Modele.Constantes.EnumTypeMedia.JEU:
                            return RedirectToAction("Details", "Jeu", new { codeMedia = pCodeMedia });
                        default:
                            throw new Exception("Cas non géré");
                    }
                }
                catch (Exception ex)
                {
                    HandleErrorInfo error = new HandleErrorInfo(ex, "Film", "DeleteExemplaire");
                    return View("Error", error);
                }

            }
            else
            {
                return RedirectToAction("LogOn", "Account");
            }
        }