public ActionResult GetAllMatches(int spieltag)
        {
            var matches = _matchDataRepository.GetMatchesByGroup(spieltag);

            using (var ctxt = new MatchInfoContext())
            {
                foreach (var m in matches)
                {
                    ctxt.Items.Add(new MatchInfoItem()
                    {
                        GroupId         = m.GroupId,
                        MatchId         = m.MatchId,
                        MatchNr         = m.MatchNr,
                        HomeTeamId      = m.HomeTeamId,
                        AwayTeamId      = m.AwayTeamId,
                        HomeTeam        = m.HomeTeam,
                        AwayTeam        = m.AwayTeam,
                        HomeTeamScore   = m.HomeTeamScore,
                        AwayTeamScore   = m.AwayTeamScore,
                        HomeTeamIcon    = m.HomeTeamIcon,
                        AwayTeamIcon    = m.AwayTeamIcon,
                        KickoffTime     = m.KickoffTime,
                        KickoffTimeUtc  = m.KickoffTimeUTC,
                        IsFinished      = m.IsFinished,
                        HasProlongation = m.HasVerlaengerung
                    });
                }

                ctxt.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
예제 #2
0
 public DummyController(MatchInfoContext _ctx)
 {
     _ctx = ctx ?? throw new ArgumentNullException(nameof(ctx));
 }
예제 #3
0
 public MatchInfoRepository(MatchInfoContext context)
 {
     _context = context ?? throw new ArgumentException(nameof(context));
 }