// 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 MusicStoreQuery(ICategoryRepository categoryRepository, IProductRepository productRepository, IVenueRepository venueRepository, IMusicianRepository musicianRepository) { Field <CategoryType>( "category", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "id", Description = "Category id" } ), resolve: context => categoryRepository.GetCategoryAsync(context.GetArgument <int>("id")).Result ); Field <ProductType>( "product", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "id", Description = "Product id" } ), resolve: context => productRepository.GetProductAsync(context.GetArgument <int>("id")).Result ); Field <ListGraphType <VenueType> >( "venues", resolve: context => venueRepository.GetAllAsync().Result ); Field <VenueType>( "venue", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "id", Description = "Venue id" } ), resolve: context => venueRepository.GetAsync(context.GetArgument <int>("id")).Result ); Field <ListGraphType <MusicianType> >( "musicians", resolve: context => musicianRepository.GetAllAsync().Result ); Field <MusicianType>( "musician", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "id", Description = "Musician id" } ), resolve: context => musicianRepository.GetAsync(context.GetArgument <int>("id")).Result ); }
// GET: Venues public async Task <IActionResult> Index(int?page) { await auditLogger.log(GetUserId(), "Accessed Venue Index"); IQueryable <Venue> venues = venueRepository.GetAllAsync().OrderBy(v => v.VenueName); venues = venues.OrderBy(v => v.VenueName); var venueList = await venues.ToListAsync(); var pageNumber = page ?? 1; // if no page was specified in the querystring, default to the first page (1) var venuesPerPage = 10; var onePageOfVenue = venueList.ToPagedList(pageNumber, venuesPerPage); // will only contain 25 products max because of the pageSize ViewBag.onePageOfVenue = onePageOfVenue; return(View()); }
public IActionResult GetAllVenues() { var venues = venueRepository.GetAllAsync(); return(Ok(venues.ToList())); }