Ejemplo n.º 1
0
        public async static void SubmitSurvey(SurveyViewModel svm)
        {
            var respo = await APIService.PostNew <SurveyModel>(svm.surveyModel, "api/survey");

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

                if (content.ToLower().Contains("success"))
                {
                    Application.Current.Properties["DidSurveySubmitOk"] = true;
                }
                else
                {
                    Application.Current.Properties["DidSurveySubmitOk"] = false;
                }
            }
            else
            {
                Application.Current.Properties["DidSurveySubmitOk"] = false;
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        internal async Task <bool> DeleteCollection(CollectionsResp coll)
        {
            string endpoint = "api/Collections?id=" + coll.Id;

            var resp = await APIService.Delete(endpoint);

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

                if (cont.ToLower().Contains("success"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 7
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);
            }
        }