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; }
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); } }