public SimpleStation Save(SimpleStation station)
        {
            _db.Stations.Add(station);
            _db.SaveChanges();

            return(station);
        }
        public IActionResult Post()
        {
            try
            {
                var weatherStations   = _importService.GetAllStations();
                var simpleStationList = new List <SimpleStation>();

                foreach (var station in weatherStations.Station)
                {
                    var simpleStation = new SimpleStation
                    {
                        Name      = station.Name,
                        Id        = station.Id.ToString(),
                        Latitude  = station.Latitude,
                        Longitude = station.Longitude,
                        Altitude  = station.Height
                    };

                    simpleStationList.Add(simpleStation);
                }



                return(Ok("Import complete"));
            }
            catch (Exception)
            {
                return(StatusCode(503));
            }
            return(Ok());
        }
Пример #3
0
        public static StationCardFragment WithStation(SimpleStation station, BikeActionStatus status)
        {
            var r = new StationCardFragment();

            r.station = station;
            r.status  = status;
            return(r);
        }
Пример #4
0
        public void NavigateToStation(SimpleStation station)
        {
            Finish();
            var culture = System.Globalization.CultureInfo.InvariantCulture;
            var req     = string.Format("google.navigation:///?q={0},{1}&mode=w",
                                        station.Lat.ToString(culture),
                                        station.Lon.ToString(culture));
            var geoUri = Android.Net.Uri.Parse(req);
            var intent = new Intent(Intent.ActionView, geoUri);

            //intent.SetPackage ("com.google.android.apps.maps");
            StartActivity(intent);
        }
Пример #5
0
        public async Task <List <SimpleStation> > ReadAirTempRespons(Task <HttpResponseMessage> responseTask)
        {
            List <SimpleStation> simpleStationList = new List <SimpleStation>();
            var responseMessage = await responseTask;
            var contentString   = await responseMessage.Content.ReadAsStringAsync();

            var apiModel = JsonConvert.DeserializeObject <LufttemperaturApiSvar>(contentString);

            foreach (var station in apiModel.station)
            {
                var simpleStation = new SimpleStation()
                {
                    Name      = station.name,
                    Id        = station.id,
                    Latitude  = station.latitude,
                    Longitude = station.longitude
                };

                simpleStationList.Add(simpleStation);
            }

            return(simpleStationList);
        }