Exemplo n.º 1
0
        public IActionResult Add(string returnUrtl = null)
        {
            var ap   = _airports.GetAll().ToList();
            var comp = _companies.GetAll().ToList();
            var pl   = _airplanes.GetAll().ToList();

            ViewBag.Airports  = new SelectList(ap, "Id", "Name");
            ViewBag.Companies = new SelectList(comp, "Id", "CompanyName");
            ViewBag.Airplanes = new SelectList(pl, "Id", "Model");
            return(View());
        }
Exemplo n.º 2
0
        public IActionResult Book()
        {
            BookViewModel model = new BookViewModel();

            model.Airports = _airportRep.GetAll().ToArray();
            model.Today    = DateTime.Now.ToShortDateString();
            return(View(model));
        }
Exemplo n.º 3
0
        public BillionQuery(CityRepository cityRepository, AirportRepository airportRepository, CountryRepository countryRepository)
        {
            Field <ListGraphType <CityType> >("cityList", description: "Query to get a list of cities", resolve: fieldContext => cityRepository.GetAll());

            Field <CityType>()
            .Name("city")
            .Argument <NonNullGraphType <IdGraphType> >("cityID", "The ID of the city to fetch")
            .Resolve(context =>
            {
                var cityId = context.GetArgument <Guid>("cityID");
                return(cityRepository.GetOne(cityId));
            });

            Field <ListGraphType <AirportType> >("airportList", description: "Query to get a list of airports", resolve: fieldContext => airportRepository.GetAll());

            Field <AirportType>()
            .Name("airport")
            .Argument <NonNullGraphType <IdGraphType> >("airportID", "The ID of the airport to fetch")
            .Resolve(context =>
            {
                var airportId = context.GetArgument <Guid>("airportID");
                return(airportRepository.GetOne(airportId));
            });


            Field <ListGraphType <CountryType> >("countryList", description: "Query to get a list of countries", resolve: fieldContext => countryRepository.GetAll());

            Field <ListGraphType <CountryType> >("countryListWithChildren", description: "Query to get a list of countries, with all child objects", resolve: fieldContext => countryRepository.GetAllWithChildren());

            Field <CountryType>()
            .Name("country")
            .Argument <NonNullGraphType <IdGraphType> >("countryID", "The ID of the country to fetch")
            .Resolve(context =>
            {
                var countryId = context.GetArgument <Guid>("countryID");
                return(countryRepository.GetOne(countryId));
            });
        }