Ejemplo n.º 1
0
        public ActionResult AssistDetail(int idSeason)
        {
            using (var context = new FcDeHoekContext())
            {
                var tempData = GetTempDataForDetail(idSeason, context).OrderByDescending(td => td.Assists).ToList();
                var season   = SeasonQueries.GetById(context, idSeason);

                var keyValue = idSeason == -1 || season == null
                    ? "All Time Assists"
                    : $"Assists {season.SeasonStartYear} - {season.SeasonEndYear}";

                var model         = new Dictionary <string, List <RecordsPlayer> >();
                var playerRecords = new List <RecordsPlayer>();
                foreach (var data in tempData)
                {
                    if (data.Assists != 0)
                    {
                        playerRecords.Add(new RecordsPlayer
                        {
                            Player = data.Player,
                            Stat   = data.Assists
                        });
                    }
                }

                model.Add(keyValue, playerRecords);

                return(View("Detail", model));
            }
        }
Ejemplo n.º 2
0
 private string GetSeason(int idSeason)
 {
     using (var context = new FcDeHoekContext())
     {
         var season = SeasonQueries.GetById(context, idSeason);
         return(season == null ? string.Empty : $"{season.SeasonStartYear} - {season.SeasonEndYear}");
     }
 }
Ejemplo n.º 3
0
        public ActionResult SeasonDetail(int idSeason)
        {
            using (var context = new FcDeHoekContext())
            {
                var season = new Season();
                if (idSeason != 0)
                {
                    season = SeasonQueries.GetById(context, idSeason);
                }


                return(View(MapSeasonToSeasonModel(season, null)));
            }
        }
Ejemplo n.º 4
0
        private List <RecordsTempData> GetTempDataForDetail(int idSeason, FcDeHoekContext context)
        {
            List <RecordsTempData> tempData;

            if (idSeason == -1)
            {
                var historicData = GetHistoricData(context);
                tempData = GetCurrentData(context, historicData);
            }
            else
            {
                var season = SeasonQueries.GetById(context, idSeason);
                tempData = season != null
                    ? season.SeasonStartYear >= eStatsSince.SiteStartYear
                        ? GetCurrentData(context, new List <RecordsTempData>(), idSeason)
                        : GetHistoricData(context, idSeason)
                    : new List <RecordsTempData>();
            }

            return(tempData);
        }
Ejemplo n.º 5
0
        public ActionResult Save(SeasonModel model)
        {
            using (var context = new FcDeHoekContext())
            {
                Season season;
                if (model.IdSeason == 0)
                {
                    season = new Season();
                }
                else
                {
                    season = SeasonQueries.GetById(context, model.IdSeason);
                }

                season.SeasonStartYear = model.StartYear;
                season.SeasonEndYear   = model.EndYear;
                season.Division        = model.Division;

                context.Seasons.AddOrUpdate(season);
                context.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }