コード例 #1
0
        public async Task <IActionResult> BusStops([FromQuery] SearchOptions <BusStopViewModel, BusStop> searchOptions)
        {
            var busStops = await busService.GetAllBusStopsAsync(searchOptions);

            var busStopsResponse = new BusStopstResponse()
            {
                Self              = LinkGenerator.ToCollection(RouteNames.ListBusStops),
                Value             = busStops.ToArray(),
                BusStopSequence   = LinkGenerator.ToCollection(RouteNames.StopSequence, new { busId = "exampleBusId" }),
                BusStopForm       = FormMetadata.FromModel(new BusStopBindingModel(), LinkGenerator.ToForm(RouteNames.PostBusStop, null, LinkGenerator.PostMethod, Form.CreateRelation)),
                BusStopByName     = LinkGenerator.To(RouteNames.BusStop, new { id = "exampleBusStopId" }),
                DepartureTimes    = LinkGenerator.ToCollection(RouteNames.DepartureTimes, new { busId = "exampleBusId" }),
                BusStopsQueryForm = FormHelper.FromResource <BusStopViewModel>(LinkGenerator.ToForm(RouteNames.ListBusStops, null, LinkGenerator.GetMethod, Form.QueryRelation)),
            };

            return(Ok(busStopsResponse));
        }