Ejemplo n.º 1
0
        public ActionResult Create()
        {
            var books            = bookRepository.GetAll();
            var authors          = authorRepository.GetAll();
            var genres           = genreRepository.GetAll();
            var series           = seriesRepository.GetAll();
            var bookSelectList   = new SelectList(books, "ID", "Name");
            var authorSelectList = new SelectList(authors, "ID", "Name");
            var genreSelectList  = new SelectList(genres, "ID", "Name");
            var seriesSelectList = new SelectList(series, "ID", "Name");

            ViewBag.Books   = bookSelectList;
            ViewBag.Genres  = genreSelectList;
            ViewBag.Authors = authorSelectList;
            ViewBag.Series  = seriesSelectList;
            return(View(new CreateBookViewModel()));
        }
 public override void MigrateFixtures(int htSeriesId, int season)
 {
     var seriesFixturesResult = GetSeriesFixtures(season, htSeriesId);
     Session.Clear();
     var repository = new SeriesRepository(Session);
     var series = repository.GetAll().First(s => s.HtSeriesId == htSeriesId);
     SetFixtures(series, season, seriesFixturesResult);
     using (var transaction = Session.BeginTransaction())
     {
         repository.SaveUpdate(series);
         transaction.Commit();
     }
 }
        public ActionResult Index()
        {
            List <Series>          allSeries = new List <Series>();
            List <SeriesViewModel> model     = new List <SeriesViewModel>();

            allSeries = seriesRepository.GetAll();
            foreach (var series in allSeries)
            {
                SeriesViewModel seriesViewModel = new SeriesViewModel()
                {
                    Name = series.Name,
                    ID   = series.ID
                };
                model.Add(seriesViewModel);
            }
            return(View(model));
        }
        public override void MigrateMatchDetails(int matchId, int matchRound, int season, int htSeriesId)
        {
            var matchDetails = GetMatchDetails(matchId);
            Session.Clear();
            var repository = new SeriesRepository(Session);
            var series = repository.GetAll().First(s => s.HtSeriesId == htSeriesId);

            var match = series.Matches.FirstOrDefault(m => m.MatchId == matchId);
            var htMatch = matchDetails.Match.First();
            DateTime matchFinishDate;
            if (DateTime.TryParse(htMatch.FinishedDate, out matchFinishDate))
            {
                var htAwayTeam = htMatch.AwayTeam.First();
                var htHomeTeam = htMatch.HomeTeam.First();
                if (match == null)
                {
                    match = new Match
                    {
                        HtMatchId = int.Parse(htMatch.MatchID),
                        MatchDate = DateTime.Parse(htMatch.MatchDate),
                        FinishedDate = DateTime.Parse(htMatch.FinishedDate),
                        MatchArena = new MatchArena
                        {
                            ArenaName = htMatch.MatchArena.ArenaName,
                            HtArenaId = int.Parse(htMatch.MatchArena.ArenaID),
                            WeatherId = short.Parse(htMatch.MatchArena.WeatherID)
                        },
                        MatchType = short.Parse(htMatch.MatchType),
                        MatchSeason = (short)season,
                        MatchRound = (short)matchRound
                    };
                    match.SetMatchHomeTeam(GetMatchTeam(series.Country, htHomeTeam, htMatch.PossessionFirstHalfHome,
                                                        htMatch.PossessionSecondHalfHome));
                    match.SetMatchAwayTeam(GetMatchTeam(series.Country, htAwayTeam, htMatch.PossessionFirstHalfAway,
                                                        htMatch.PossessionSecondHalfAway));
                    ProcessScorers(match, htMatch);
                    ProcessInjuries(match, htMatch);
                    ProcessBookings(match, htMatch);
                    ProcessEvents(match, htMatch);
                    series.AddMatch(match);
                }
            }
            repository.SaveUpdate(series);
            Session.Flush();
        }
Ejemplo n.º 5
0
        public ActionResult Find(vmSearch vm)
        {
            var results = !string.IsNullOrWhiteSpace(vm.SearchTerm) ? _seriesRepository.GetByTitle(vm.SearchTerm) : _seriesRepository.GetAll();

            return(PartialView("_gridResultsPanel", results));
        }