// GET: Facilities/Create public async Task <IActionResult> Create() { await auditLogger.log(GetUserId(), "Accessed Create Facilities"); ViewData["SportId"] = new SelectList(sportRepository.GetAllAsync(), "SportId", "SportName"); ViewData["VenueId"] = new SelectList(venueRepository.GetAllAsync(), "VenueId", "VenueName"); return(View()); }
public IActionResult GetSport([FromRoute] int id) { var facilities = facilityRepository.GetAllAsync().Where(f => f.VenueId == id); var sports = sportRepository.GetAllAsync(); var results = new List <Sport>(); foreach (Facility f in facilities) { results.Add(sports.Where(s => s.SportId.Equals(f.SportId)).Single()); } return(Ok(results.Distinct())); }
// GET: Sports public async Task <IActionResult> Index(int?page) { await auditLogger.log(GetUserId(), "Accessed Sport Index"); var sportsQ = sportRepository.GetAllAsync().OrderBy(s => s.SportName); var sportsList = await sportsQ.ToListAsync(); var pageNumber = page ?? 1; var sportsPerPage = 10; var onePageOfSports = sportsList.ToPagedList(pageNumber, sportsPerPage); ViewBag.onePageOfSports = onePageOfSports; return(View()); }
public async Task <List <ISport> > GetAllAsync(string search, int page, string sortBy) { return(await Repository.GetAllAsync(search, page, sortBy)); }