Esempio n. 1
0
        public async Task <List <Pushresp> > GetPushMessages()
        {
            //string testuser = "******";
            var    PushRepList = new List <Models.Pushresp>();
            string endpoint    = "/api/PushNotification";
            //string endpoint = "GetByUserID?User_id=" + testuser;
            var response = await APIService.Get(endpoint);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var content = await response.Content.ReadAsStringAsync();

                content = Utility.ReplaceFirstOccurrence(content, "[", "");
                content = Utility.ReplaceLastOccurrence(content, "]", "");
                var model = JsonConvert.DeserializeObject <MyMessages>(content);

                //var model = JsonConvert.DeserializeObject<ObservableCollection<Models.FavoriteModel>>(content);
                if (model.Message.ToLower().Contains("success"))
                {
                    foreach (var item in model.Pushresp)
                    {
                        var msgg = item;
                        PushRepList.Add(msgg);
                    }
                }

                return(PushRepList.OrderByDescending(d => d.Created).ToList());
            }

            else
            {
                var content = await response.Content.ReadAsStringAsync();

                var empty = new List <Models.Pushresp>();
                return(empty);
            }
        }
Esempio n. 2
0
        public async Task <ObservableCollection <NewCategoryDetailModel.Deal> > GetAllByCategoryID2(int id = 0)
        {
            ObservableCollection <NewCategoryDetailModel.Deal> deals = new ObservableCollection <NewCategoryDetailModel.Deal>();
            DealRootObject dealRootObject = new DealRootObject();
            var            respo          = await APIService.Get($"api/all/getallbycategoryid2?id={id}");

            if (respo.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var content = await respo.Content.ReadAsStringAsync();

                var categoryDetail = JsonConvert.DeserializeObject <NewCategoryDetailModel.RootObject>(content);
                if (categoryDetail.Message.Contains("Success"))
                {
                    //ActvRootList = JsonConvert.DeserializeObject<ObservableCollection<Activity_RootObject>>(content);

                    deals = categoryDetail.Deals;
                }
            }
            else
            {
                var content = await respo.Content.ReadAsStringAsync();
            }
            return(deals);
        }
Esempio n. 3
0
        public async Task <ObservableCollection <Deals> > GetDealsOriginal(string id = "")
        {
            DealRootObject deal = new DealRootObject();
            ObservableCollection <Deals>          listofdeals = new ObservableCollection <Deals>();
            ObservableCollection <DealRootObject> deallist    = new ObservableCollection <DealRootObject>();

            var respo = await APIService.Get("api/deals");

            if (respo.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var content = await respo.Content.ReadAsStringAsync();

                deal = JsonConvert.DeserializeObject <DealRootObject>(content);
                if (deal.Message.Contains("Success"))
                {
                    listofdeals = deal.Deals;
                }
            }
            else
            {
                var content = await respo.Content.ReadAsStringAsync();
            }
            return(listofdeals);
        }
Esempio n. 4
0
        public async Task <ObservableCollection <NewDealsModel.Deal> > GetDeals(string id = "")
        {
            ObservableCollection <NewDealsModel.Deal> listOfAllDeals = new ObservableCollection <NewDealsModel.Deal>();

            var respo = await APIService.Get("api/deals");

            if (respo.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var content = await respo.Content.ReadAsStringAsync();

                var dealls = JsonConvert.DeserializeObject <NewDealsModel.RootObject>(content);

                //deal = JsonConvert.DeserializeObject<DealRootObject>(content);
                if (dealls.Message.ToLower().Contains("success"))
                {
                    listOfAllDeals = dealls.Deals;
                }
            }
            else
            {
                var content = await respo.Content.ReadAsStringAsync();
            }
            return(listOfAllDeals);
        }
Esempio n. 5
0
        public async Task <Models.CollectionsModelResp> GetUserFavsNew()
        {
            //string testuser = "******";
            string endpoint = "/GetByUserID?User_id=" + GlobalStaticFields.Username;
            //string endpoint = "GetByUserID?User_id=" + testuser;
            var response = await APIService.Get(endpoint);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var content = await response.Content.ReadAsStringAsync();

                var model = JsonConvert.DeserializeObject <Models.CollectionsModelResp>(content);
                //var model = JsonConvert.DeserializeObject<ObservableCollection<Models.FavoriteModel>>(content);
                return(model);
            }

            else
            {
                var content = await response.Content.ReadAsStringAsync();

                var empty = new Models.CollectionsModelResp();
                return(empty);
            }
        }