コード例 #1
0
 public void Post([FromBody] ParkingOperator parkingOperator)
 {
     _dao.InsertParking(parkingOperator.OperatorName, parkingOperator.Latitude, parkingOperator.Longitude,
                        parkingOperator.Address1,
                        parkingOperator.City, parkingOperator.State, parkingOperator.Zip, parkingOperator.Phone,
                        parkingOperator.WebsiteUrl,
                        parkingOperator.NumberOfSpaces, parkingOperator.InitialFee, parkingOperator.InitialHours,
                        parkingOperator.SubsequentHourlyFee, parkingOperator.AcceptsCash, parkingOperator.AcceptsCredit,
                        parkingOperator.CoveredParking, parkingOperator.Open24Hours,
                        parkingOperator.HourOpen, parkingOperator.HourClosed, parkingOperator.EventParking,
                        parkingOperator.ParkingGarage);
 }
コード例 #2
0
        public static JObject ToJSON(this ParkingOperator ParkingOperator,
                                     Boolean Embedded = false,
                                     Boolean ExpandChargingRoamingNetworkId = false,
                                     Boolean ExpandChargingPoolIds          = false,
                                     Boolean ExpandChargingStationIds       = false,
                                     Boolean ExpandEVSEIds = false)

        => ParkingOperator != null
                   ? JSONObject.Create(

            new JProperty("id", ParkingOperator.Id.ToString()),

            Embedded
            ?null
            : ExpandChargingRoamingNetworkId
            ?new JProperty("roamingNetwork", ParkingOperator.RoamingNetwork.ToJSON())
            : new JProperty("roamingNetworkId", ParkingOperator.RoamingNetwork.Id.ToString()),

            new JProperty("name", ParkingOperator.Name.ToJSON()),
            new JProperty("description", ParkingOperator.Description.ToJSON()),

            // Address
            // LogoURI
            // API - RobotKeys, Endpoints, DNS SRV
            // MainKeys

            ParkingOperator.Logo.IsNotNullOrEmpty()
            ?new JProperty("logos", JSONArray.Create(
                               JSONObject.Create(
                                   new JProperty("uri", ParkingOperator.Logo),
                                   new JProperty("description", I18NString.Empty.ToJSON())
                                   )
                               ))
            : null,

            ParkingOperator.Homepage.IsNotNullOrEmpty()
            ?new JProperty("homepage", ParkingOperator.Homepage)
            : null,

            ParkingOperator.HotlinePhoneNumber.IsNotNullOrEmpty()
            ?new JProperty("hotline", ParkingOperator.HotlinePhoneNumber)
            : null,

            ParkingOperator.DataLicenses.Any()
            ?new JProperty("dataLicenses", new JArray(ParkingOperator.DataLicenses.Select(license => license.ToJSON())))
            : null

            //new JProperty("chargingPools",         ExpandChargingPoolIds
            //                                           ? new JArray(ParkingOperator.ChargingPools.     ToJSON(Embedded: true))
            //                                           : new JArray(ParkingOperator.ChargingPoolIds.   Select(id => id.ToString()))),

            //new JProperty("chargingStations",      ExpandChargingStationIds
            //                                           ? new JArray(ParkingOperator.ChargingStations.  ToJSON(Embedded: true))
            //                                           : new JArray(ParkingOperator.ChargingStationIds.Select(id => id.ToString()))),

            //new JProperty("evses",                 ExpandEVSEIds
            //                                           ? new JArray(ParkingOperator.EVSEs.             ToJSON(Embedded: true))
            //                                           : new JArray(ParkingOperator.EVSEIds.           Select(id => id.ToString())))

            )
                   : null;
コード例 #3
0
        public static JProperty ToJSON(this ParkingOperator ParkingOperator, String JPropertyKey)

        => ParkingOperator != null
                   ? new JProperty(JPropertyKey, ParkingOperator.ToJSON())
                   : null;