/// <summary> /// Action for detail of race /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var race = await GetSingleRaceAsync(r => r.ID == id); if (race == null) { return(NotFound()); } RaceDetailViewModel raceDetail = new RaceDetailViewModel { Race = race, Map = race.Map, Categories = race.Categories.OrderBy(c => c.Name).Select(c => new SelectListItem { Value = c.ID.ToString(), Text = c.Name, }).ToList(), HasStravaAccount = false }; raceDetail.Categories.Insert(0, new SelectListItem { Value = "0", Text = "Vyberte kategorii", Selected = true }); return(View(raceDetail)); }
public void DetailViewModelToModelTest() { var viewModel = new RaceDetailViewModel { CoordinatesCheckEnabled = true, MaxDuration = new TimeSpan(), MaximumTeamSize = 1, MinimumPointsToCompleteStage = 1, Name = "a", PenaltyPerMinuteLate = 1, RaceId = Guid.NewGuid(), SpecialTasksAreStage = true, Stages = new List <StageViewModel>(), StartTime = DateTime.Now, Teams = new List <TeamViewModel>(), }; var result = _Sut.Map <Race>(viewModel); Assert.AreEqual(viewModel.CoordinatesCheckEnabled, result.CoordinatesCheckEnabled); Assert.AreEqual(viewModel.MaxDuration, result.MaxDuration); Assert.AreEqual(viewModel.MaximumTeamSize, result.MaximumTeamSize); Assert.AreEqual(viewModel.MinimumPointsToCompleteStage, result.MinimumPointsToCompleteStage); Assert.AreEqual(viewModel.Name, result.Name); Assert.AreEqual(viewModel.PenaltyPerMinuteLate, result.PenaltyPerMinuteLate); Assert.AreEqual(viewModel.RaceId, result.RaceId); Assert.AreEqual(viewModel.SpecialTasksAreStage, result.SpecialTasksAreStage); Assert.IsNotNull(result.Stages); Assert.AreEqual(viewModel.StartTime, result.StartTime); Assert.IsNotNull(result.Teams); }
public RaceDetailPage(RaceDetailViewModel viewModel) { InitializeComponent(); BindingContext = this.viewModel = viewModel; _qrCodeResultParser = DependencyService.Get <IParseQrCodeResultService>(); _raceVenturaApiClient = DependencyService.Get <IRaceVenturaApiClient>(); _locationService = DependencyService.Get <ILocationService>(); }
public RaceDetailPage(RaceDetailViewModel viewModel) { InitializeComponent(); BindingContext = this.viewModel = viewModel; viewModel.LayoutQualy = layoutQualifying; viewModel.LayoutFastestLap = layoutFastestLap; viewModel.ButtonRaceEvolution = bRaceEvolution; viewModel.ButtonConstructorStandings = bConstructorStandings; }