Exemplo n.º 1
0
        public ActionResult SportsInformation(int?id)
        {
            if (id == null)
            {
                id = 0;
            }
            CustomSportsInformationModel obj = getSportsInformation(id);

            if (obj.sport == null)
            {
                return(HttpNotFound());
            }

            return(View(obj));
        }
Exemplo n.º 2
0
        public CustomSportsInformationModel getSportsInformation(int?id)
        {
            List <Sport> sportList           = db.Sports.ToList();
            List <Term>  termList            = db.Terms.ToList();
            CustomSportsInformationModel obj = new CustomSportsInformationModel();

            var terms = db.Terms.Where(t => t.Sports.Any(s => s.SPORT_ID == id)).ToList();

            obj.sport = db.Sports.Find(id);

            obj.sportsid   = new List <int>();
            obj.sportsName = new List <string>();
            obj.termsList  = new List <Term>(terms);


            for (int i = 0; i < sportList.Count; i++)
            {
                obj.sportsid.Add(sportList[i].SPORT_ID);
                obj.sportsName.Add(sportList[i].SPORT_NAME);
            }

            return(obj);
        }