Пример #1
0
        public ActionResult DeleteSouhait(Guid pCodeMedia, Guid pCodeSouhait, FormCollection collection)
        {
            if (Request.IsAuthenticated)
            {
                try
                {
                    GestionnaireMedias gestionnaireMedias = new GestionnaireFilms();
                    gestionnaireMedias.SupprimerSouhaitAchat(pCodeSouhait);

                    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", "DeleteSouhait");
                    return View("Error", error);
                }

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