Пример #1
0
        public bool AssignChipToUserInHeat(ChipInHeat c)
        {
            var result = true;

            try
            {
                result = _repo.AssignChipToUserInHeat(c);
            }
            catch (Exception e)
            {
                var heat      = _heatService.GetHeatByIdAsync(c.HeatId).Result;
                var thisEvent = _eventService.GetEventById(heat.EventId);
                throw new Exception("Failed to assign chip in heat" + heat.HeatNumber + " in " + thisEvent.Name + ". Please use another chip." + "\r\n" + e.Message);
            }
            UpdateChipStory(c).Wait();
            return(result);
        }
Пример #2
0
        public async Task <IActionResult> Edit(int competitionId, int competitionInstanceId, int eventId, int heatId)
        {
            var entity = await _heatService.GetHeatByIdAsync(heatId);

            if (entity == null)
            {
                return(NotFound());
            }
            return(View(entity));
        }
Пример #3
0
        public async void TestDeleteHeat()
        {
            //Arrange
            await _service.AddAsync(1);

            await _service.AddAsync(1);

            await _service.AddAsync(1);

            //Act
            await _service.RemoveAsync(2);

            Heat result = await _service.GetHeatByIdAsync(2);

            var result2 = _service.GetDeletedHeatsForEvent(1);

            //Assert
            Assert.Equal(expected: true, actual: result.Deleted);
            Assert.Equal(expected: 1, actual: result2.Count());
        }
Пример #4
0
        public async Task <IActionResult> Heat(string search, int competitionId, int competitionInstanceId, int eventId, int heatId)
        {
            ViewData["CurrentFilter"] = search;
            var heat = await _heatService.GetHeatByIdAsync(heatId);

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

            var competition = await _competitionService.GetCompetitionByIdAsync(competitionId);

            var competitionInstance = await _competitionService.GetCompetitionInstanceByIdAsync(competitionInstanceId);

            var instanceEvent = await _eventService.GetEventByIdAsync(eventId);

            var contestants = _heatService.GetContestantsInHeat(heat.Id);

            if (!String.IsNullOrEmpty(search))
            {
                var searchToUpper = search.ToUpper();
                contestants = contestants.Where(u => u.Name.ToUpper().Contains(searchToUpper) ||
                                                u.Ssn.ToUpper().Contains(searchToUpper));
            }

            var heatDto = new HeatDto()
            {
                Competition         = competition,
                CompetitionInstance = competitionInstance,
                Event       = instanceEvent,
                Heat        = heat,
                Contestants = contestants.OrderBy(x => x.Name)
            };

            return(View(heatDto));
        }