Exemple #1
0
        public ActionResult GetComp(int id)
        {
            Session["idSC"] = id;

            Competition comp = new Competition();

            if (id != -1)
            {
                List <CPays> listePays = new CPays().GetListPays();
                Session["listePays"] = new SelectList(listePays, "Id", "Pays");
                List <Competition> triedList = new List <Competition>();
                foreach (Competition c in comp.GetList())
                {
                    if (c.SousCat.Id == id)
                    {
                        c.GetTournoi();
                        triedList.Add(c);
                    }
                }
                foreach (Categorie c in Categorie.GetList())
                {
                    if (c.Id == (int)Session["idC"])
                    {
                        ViewBag.cat = c;
                    }
                }
                if (Session["triedList"] != null)
                {
                    ViewBag.listComp     = Session["triedList"];
                    Session["triedList"] = null;
                }
                else
                {
                    ViewBag.listComp = triedList;
                }
            }
            return(View());
        }