Esempio n. 1
0
 public AddPageViewModel(Page page, INavigation navigation, UserModel user)
 {
     Title                  = "Add Annonce";
     this.OnAdd             = new Command(async() => await OnAddRequest());
     this._annoncesServices = new AnnoncesServices();
     this._annonceModel     = new AnnoncePostModel();
     this.navigation        = navigation;
     this._page             = page;
     this._user             = user;
 }
Esempio n. 2
0
        public async Task <bool> Post(AnnoncePostModel annonceModel)
        {
            try
            {
                var content    = JsonConvert.SerializeObject(annonceModel);
                var JsontoPost = new StringContent(content, Encoding.UTF8, "application/json");
                var response   = await _client.PostAsync(this._postUrl, JsontoPost);

                if (response.IsSuccessStatusCode)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(true);
            }
        }