示例#1
0
        internal async Task <bool> CreateNewCollection(string newCollectionName, string newCollectionNick)
        {
            var newCollection = new Collections
            {
                User_id  = GlobalStaticFields.Username,
                Name     = newCollectionName,
                NickName = newCollectionNick
            };
            var resp = await APIService.PostNew <Collections>(newCollection, "api/Collections");

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

                if (cont.Contains("Record Added Successfully"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public async Task <bool> SaveFavorites(Favourite favourite)
        {
            FavoritesModelAPIResponse            fav        = new FavoritesModelAPIResponse();
            ObservableCollection <Favourite>     listofFavs = new ObservableCollection <Favourite>();
            ObservableCollection <FavRootObject> Favlist    = new ObservableCollection <FavRootObject>();

            var respo = await APIService.PostNew(favourite, "api/UserFavourites/");

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


                if (content.ToLower().Contains("success"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
            return(false);
        }
示例#3
0
        internal async Task <bool> DeleteCollectionWithDetails(Favourite ctl, string CategoryID)
        {
            bool response = false;

            try
            {
                string endpoint = $"DeleteFavorite?id={CategoryID}";
                var    add      = await APIService.PostNew <Favourite>(ctl, endpoint);

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

                    if (content.ToLower().Contains("success"))
                    {
                        response = true;
                    }
                }

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

                    response = false;
                }
            }
            catch (Exception ex)
            {
                LogService.LogErrors(ex.ToString());
                response = false;
            }

            return(response);
        }
示例#4
0
        internal async Task <ObservableCollection <NewDealsModel.Deal> > GetAllSearch()
        {
            ObservableCollection <NewDealsModel.Deal> search = new ObservableCollection <NewDealsModel.Deal>();
            var resp = await APIService.PostNew <NewDealsModel.Deal>(null, "api/All/Search");

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

                var AllSearch = JsonConvert.DeserializeObject <NewDealsModel.RootObject>(cont);
                if (AllSearch.Message.ToLower().Contains("success"))
                {
                    search = AllSearch.Deals;
                }
                else
                {
                }
            }
            else
            {
                var cont = await resp.Content.ReadAsStringAsync();
            }

            return(search);
        }
示例#5
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;
            }
        }