Ejemplo n.º 1
0
        // private void OnTimedEvent(object source, ElapsedEventArgs e)
        // {
        //     var date = GetStartDate().GetAwaiter().GetResult();
        //     var nowDate = DateTime.Now;
        //     if (date.Date.Minute == nowDate.Date.Minute)
        //     {
        //          this.StartRally();
        //      }
        // }

        public async Task <string> RallyЕntry(TeamViewModels input)
        {
            var team = await dbContext.CompetitionsTeam
                       .Where(x => x.TeamId == input.TeamId && x.Competition.Applicable == true)
                       .FirstOrDefaultAsync();

            if (team != null)
            {
                return($"Вие вече сте записан за стезанието.");
            }

            await dbContext.CompetitionsTeam.AddAsync(new CompetitionsTeams
            {
                Team           = input.Team,
                TeamId         = input.TeamId,
                UseOfTurboType = input.UseOfTurbo,
                CompetitionId  = input.CompetitionId,
                Drive          = input.Drive,
                PilotId        = input.RallyPilotId,
                NavigatorId    = input.RallyNavigatorId,
                CarId          = input.CarId,
            });

            await dbContext.SaveChangesAsync();

            return($"Успешно се записахте за състезанието {input.Name}.");
        }
Ejemplo n.º 2
0
 public League ToData()
 {
     return(new League()
     {
         Name = Name,
         Teams = TeamViewModels.Select(x => x.ToData())
     });
 }
Ejemplo n.º 3
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var viewModel = new TeamViewModels
            {
                Team = await team.FindUserAsync(User.Identity.Name)
            };

            return(View(viewModel));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> RallyЕntry(TeamViewModels input)
        {
            _logger.LogInformation("Create Rally Еntry");
            if (!this.ModelState.IsValid)
            {
                return(this.View(input));
            }
            var text = competitions.RallyЕntry(input);

            return(this.RedirectToAction("RallyЕntry", "Competitions", new { input = text }));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> RallyЕntry(string input = null)
        {
            _logger.LogInformation("Vieew Rally Еntry");
            var user = User.Identity.Name;
            var team = await teams.FindUserAsync(user);

            var viewModel = new TeamViewModels
            {
                Id              = team.Id,
                Name            = team.Name,
                Cars            = cars.GetCar(user).Result,
                StartRaceDate   = competitions.GetStartDate().Result.ToString("D"),
                RallyPilots     = pilots.GetPilots(user),
                RallyNavigators = navigators.GetNavigators(user),
                Runway          = await runways.GetRunwayForCurrentRaceAsync(),
                TeamId          = await teams.GetTeamIdAsync(user),
                CompetitionId   = competitions.GetCompetitionId().Result,
                CompetitionName = competitions.GetCompetitionName().Result,
                Text            = input,
            };

            return(this.View(viewModel));
        }