예제 #1
0
        void Process()
        {
            var stationIds = GetRequestedStationIds();

            if (stationIds.Count() == 0)
            {
                BadRequest();
                return;
            }

            var widget            = _widgetProvider.LoadWidget(new Guid(this.Guid));
            var supportedStations = GetSupportedStations(widget);

            foreach (var stationId in stationIds)
            {
                var station = supportedStations.FirstOrDefault(s => s.Id.Equals(stationId));

                if (station == null)
                {
                    Forbid();
                    return;
                }

                if (!WidgetProvider.WidgetCompatibleToStation(widget, station))
                {
                    BadRequest();
                    return;
                }
            }
        }