示例#1
0
        public IActionResult Races(int id = -1)
        {
            if (id == -1)
            {
                id = _repository.GetFirstRace().Id;
            }
            var races = _repository.GetAllRaces(id).ToList();

            ViewBag.raceId = id;
            return(View(races));
        }
示例#2
0
 public ActionResult <IEnumerable <Race> > Get(int raceId = -1)
 {
     try
     {
         return(_repository.GetAllRaces(raceId).ToList());
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to get races: {ex}");
         return(BadRequest("Failed to get races."));
     }
 }
示例#3
0
 public async Task <IEnumerable <Race> > GetAllRaces()
 {
     try
     {
         return(await _RaceRepository.GetAllRaces());
     }
     catch (Exception ex)
     {
         File.WriteAllText("log.txt", ex.Message + " - " + ex.StackTrace);
         throw new Exception("Erro no banco de dados, contate o administrador");
     }
 }
示例#4
0
 public async Task OnGetAsync()
 {
     Races = await _repository.GetAllRaces();
 }
 public IEnumerable <Race> Get()
 {
     return(races.GetAllRaces());
 }