コード例 #1
0
        public ParkLocations CreateParkLocation(ParkLocations park)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            Details.Add(park);

            return(park);
        }
コード例 #2
0
        public void UpdatePark(string park, ParkLocations location)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var parkLocation = Details.SingleOrDefault(p => p.ParkName == park);

            if (parkLocation == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            parkLocation.ParkName      = location.ParkName;
            parkLocation.StreetAddress = location.StreetAddress;
            parkLocation.City          = location.City;
            parkLocation.State         = location.State;
            parkLocation.Zip           = location.Zip;
            parkLocation.ParkType      = location.ParkType;
            parkLocation.lat           = location.lat;
            parkLocation.lng           = location.lng;
        }