public async Task <IActionResult> AddMatch(int?id) { if (id == null) { return(NotFound()); } var groupEntity = await _context.Groups .Include(gd => gd.Tournament) .FirstOrDefaultAsync(gd => gd.Id == id); if (groupEntity == null) { return(NotFound()); } var model = new MatchViewModel { Date = DateTime.Today, Group = groupEntity, GroupId = groupEntity.Id, Teams = _combosHelper.GetComboTeams2(groupEntity.Id), DateNames = _combosHelper.GetComboDateNames(groupEntity.Tournament.Id) }; return(View(model)); }
public MatchViewModel ToMatchViewModel(MatchEntity matchEntity) { return(new MatchViewModel { 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), DateNames = _combosHelper.GetComboDateNames(matchEntity.Group.Tournament.Id), Visitor = matchEntity.Visitor, VisitorId = matchEntity.Visitor.Id, DateName = matchEntity.DateName, DateNameId = matchEntity.DateName.Id }); }