예제 #1
0
        /***
         * 创建事件接口, 可同时创建Place
         */
        public static async Task <bool> addEvent_NewPlace(String token, String name, String detail, String startTime, String endTime, String placeName, String address, String placeDetail, String price, String maxNum, StorageFile file = null)
        {
            var content = new MultipartFormDataContent();

            content.Add(new StringContent(token), "token");
            content.Add(new StringContent(name), "name");
            content.Add(new StringContent(detail), "detail");
            content.Add(new StringContent(startTime), "startTime");
            content.Add(new StringContent(endTime), "endTime");
            content.Add(new StringContent(placeName), "placeName");
            content.Add(new StringContent(placeDetail), "placeDetail");
            content.Add(new StringContent(address), "address");
            content.Add(new StringContent(maxNum), "maxNum");
            content.Add(new StringContent(price.ToString()), "price");

            if (file != null)
            {
                var streamData = await file.OpenStreamForReadAsync();

                var streamContent = new StreamContent(streamData);
                content.Add(streamContent, "image", file.Name);
            }

            var res = await BasicService.postRequestMultipartData("addEvent", content);

            return(res != null);
        }
예제 #2
0
        /***
         * 创建地点接口
         */
        public static async Task <string> addPlace(String token, String name, String address, String detail, Double price, StorageFile file = null)
        {
            var content = new MultipartFormDataContent();

            content.Add(new StringContent(token), "token");
            content.Add(new StringContent(name), "name");
            content.Add(new StringContent(address), "address");
            content.Add(new StringContent(detail), "detail");
            content.Add(new StringContent(price.ToString()), "price");

            if (file != null)
            {
                var streamData = await file.OpenStreamForReadAsync();

                var streamContent = new StreamContent(streamData);
                content.Add(streamContent, "image", file.Name);
            }
            var res = await BasicService.postRequestMultipartData("addPlace", content);

            if (res != null)
            {
                JObject id = (JObject)JsonConvert.DeserializeObject(res);
                return((string)id["place"]["name"]);
            }

            return("");
        }
예제 #3
0
        /***
         * 注册
         */
        public static async Task <JObject> Register(String username, String email, String password, String phone, StorageFile file = null)
        {
            var content = new MultipartFormDataContent();

            content.Add(new StringContent(username), "username");
            content.Add(new StringContent(email), "email");
            content.Add(new StringContent(password), "password");
            content.Add(new StringContent(phone), "phone");

            if (file != null)
            {
                var streamData = await file.OpenStreamForReadAsync();

                var streamContent = new StreamContent(streamData);
                content.Add(streamContent, "image", file.Name);
            }
            var res = await BasicService.postRequestMultipartData("register", content);

            return((res == null) ? null : (JObject)JsonConvert.DeserializeObject(res));
        }
예제 #4
0
        /***
         * 更新地点信息
         */
        public static async Task <bool> updatePlace(String token, String id, String name, String address, String detail, Double price, StorageFile file = null)
        {
            var content = new MultipartFormDataContent();

            content.Add(new StringContent(token), "token");
            content.Add(new StringContent(id), "id");
            content.Add(new StringContent(name), "name");
            content.Add(new StringContent(address), "address");
            content.Add(new StringContent(detail), "detail");
            content.Add(new StringContent(price.ToString()), "price");

            if (file != null)
            {
                var streamData = await file.OpenStreamForReadAsync();

                var streamContent = new StreamContent(streamData);
                content.Add(streamContent, "image", file.Name);
            }
            var res = await BasicService.postRequestMultipartData("updatePlace", content);

            return(res != null);
        }
예제 #5
0
        /***
         * 更新Event接口
         */
        public static async Task <bool> updateEvent(String token, String id, String name, String detail, String startTime, String endTime, String PlaceId, String maxNum, StorageFile file = null)
        {
            var content = new MultipartFormDataContent();

            content.Add(new StringContent(id), "id");
            content.Add(new StringContent(token), "token");
            content.Add(new StringContent(name), "name");
            content.Add(new StringContent(detail), "detail");
            content.Add(new StringContent(startTime), "startTime");
            content.Add(new StringContent(endTime), "endTime");
            content.Add(new StringContent(PlaceId), "placeId");
            content.Add(new StringContent(maxNum), "maxNum");

            if (file != null)
            {
                var streamData = await file.OpenStreamForReadAsync();

                var streamContent = new StreamContent(streamData);
                content.Add(streamContent, "image", file.Name);
            }
            var res = await BasicService.postRequestMultipartData("updateEvent", content);

            return(res != null);
        }