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)); }
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.")); } }
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"); } }
public async Task OnGetAsync() { Races = await _repository.GetAllRaces(); }
public IEnumerable <Race> Get() { return(races.GetAllRaces()); }