예제 #1
0
        public async Task <IActionResult> AddMatch2(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }


            var dateNameEntity = await _context.DateNames
                                 .Include(gd => gd.Tournament)
                                 .FirstOrDefaultAsync(gd => gd.Id == id);

            if (dateNameEntity == null)
            {
                return(NotFound());
            }

            var model = new MatchViewModel2
            {
                DateNameId = dateNameEntity.Id,
                Date       = DateTime.Today,
                DateName   = dateNameEntity,
                Groups     = _combosHelper.GetComboGroups(dateNameEntity.Tournament.Id),
                Teams      = _combosHelper.GetComboTeams2(0)
            };

            return(View(model));
        }
예제 #2
0
 public MatchViewModel2 ToMatchViewModel2(MatchEntity matchEntity)
 {
     return(new MatchViewModel2
     {
         Date = matchEntity.Date.ToLocalTime(),
         GoalsLocal = matchEntity.GoalsLocal,
         GoalsVisitor = matchEntity.GoalsVisitor,
         Group = matchEntity.Group,
         GroupId = matchEntity.Group.Id,
         Id = matchEntity.Id,
         IsClosed = matchEntity.IsClosed,
         Local = matchEntity.Local,
         LocalId = matchEntity.Local.Id,
         Teams = _combosHelper.GetComboTeams(matchEntity.Group.Id),
         Groups = _combosHelper.GetComboGroups(matchEntity.Group.Tournament.Id),
         Visitor = matchEntity.Visitor,
         VisitorId = matchEntity.Visitor.Id,
         DateName = matchEntity.DateName,
     });
 }