public async Task <int> Save(PosSerials obj)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();
            string method = urimainpath + "Save";

            var myContent = JsonConvert.SerializeObject(obj);

            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 + "Save?Object=" + myContent);

            //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 "";
            //}
        }
        public async Task <PosSerials> GetByID(int serialId)
        {
            PosSerials item = new PosSerials();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

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

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

            return(item);

            //PosSerials obj = new PosSerials();

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

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

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

            //    return obj;
            //}
        }