Ejemplo n.º 1
0
        /// <summary>
        /// Delete place from Plot back-end server
        /// </summary>
        /// <param name="placeId">Id of the place to delete</param>
        public void DeletePlace(string placeId)
        {
            const string Function = "place";

            CheckNotAdmin();

            HttpWebRequest webRequest = GetWebRequest("DELETE", Function, null, placeId);

            JSONresponse response = GetJSONresponse <JSONresponse>(webRequest);

            if (response == null)
            {
                throw new Exception("No response.");
            }

            // check the result codes:
            response.Check();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Update a place on the Plot back-end server
        /// </summary>
        /// <param name="placeId">Id of the place (store) to update</param>
        /// <param name="name">New (optional) name of the place</param>
        /// <param name="location">New (optional) location of the place</param>
        public void UpdatePlace(string placeId, string name, UpdateStoreRequest.StoreLocation location = null)
        {
            const string Function = "place";

            CheckNotAdmin();

            UpdateStoreRequest request = new UpdateStoreRequest()
            {
                name = name, location = location
            };

            HttpWebRequest webRequest = GetWebRequestAndSendRequest("PUT", Function, request, null, placeId);

            JSONresponse response = GetJSONresponse <JSONresponse>(webRequest); // this seems to be a 'GetPlaceResponse'!

            if (response == null)
            {
                throw new Exception("No response.");
            }

            // check the result codes:
            response.Check();
        }