Esempio n. 1
0
        public async Task <int> MultiSave(PackageUser obj, int count)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();
            string method = urimainpath + "MultiSave";

            var myContent = JsonConvert.SerializeObject(obj);

            parameters.Add("count", count.ToString());
            parameters.Add("Object", myContent);

            return(await APIResult.post(method, parameters));

            //var myContent = JsonConvert.SerializeObject(obj);
            //myContent = HttpUtility.UrlEncode(myContent);
            //Uri uri = new Uri(Global.APIUri + urimainpath + "MultiSave?Object=" + myContent+ "&count="+ count);

            //HttpResponseMessage response = new HttpResponseMessage();
            //response = await ApiConnect.ApiPostConnect(uri);
            //using (var client = new HttpClient())
            //{
            //    if (response.IsSuccessStatusCode)
            //    {
            //        var message = await response.Content.ReadAsStringAsync();
            //        message = JsonConvert.DeserializeObject<string>(message);
            //        return message;
            //    }
            //    return "";
            //}
        }
Esempio n. 2
0
        public async Task <int> packageBook(PackageUser obj)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();
            string method = urimainpath + "packageBook";

            var myContent = JsonConvert.SerializeObject(obj);

            parameters.Add("Object", myContent);

            return(await APIResult.post(method, parameters));
        }
Esempio n. 3
0
        public async Task <PackageUser> GetByID(int packageUserId)
        {
            PackageUser item = new PackageUser();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("packageUserId", packageUserId.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "GetByID", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    item = JsonConvert.DeserializeObject <PackageUser>(c.Value, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    });
                    break;
                }
            }

            return(item);

            //PackageUser obj = new PackageUser();

            //HttpResponseMessage response = new HttpResponseMessage();
            //using (var client = new HttpClient())
            //{

            //    Uri uri = new Uri(Global.APIUri + urimainpath + "GetByID?packageUserId=" + packageUserId);

            //    response = await ApiConnect.ApiGetConnect(uri);
            //    if (response.IsSuccessStatusCode)
            //    {
            //       var jsonString = await response.Content.ReadAsStringAsync();
            //        obj = JsonConvert.DeserializeObject<PackageUser>(jsonString);
            //        return obj;
            //    }

            //    return obj;
            //}
        }