public void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e != null)
     {
         SelectedPub = (Publication)e.Parameter;
     }
 }
            public async void setPublication()
            {
              if (fieldsOK())
              {
                Publication newPub = new Publication();
                newPub.Author_id = Globals.currentUserId;
                newPub.Category_label = SelectedCategory;
                newPub.Description = Description;
                newPub.Email = Email;
                newPub.Is_offer = OffersChecked;
                newPub.Phone_number = Phone_Number;
                newPub.Province_label = SelectedProvince;
                newPub.Publication_id = await dataAccess.getNewPublicationID();
                newPub.Title = Title;

                

                if (await dataAccess.setPublicationAsync(newPub))
                {
                    new MessageDialog(ResourceManager.Current.MainResourceMap.GetValue("Resources/Publication_successfully_created").ValueAsString).ShowAsync();
                    _navigationService.NavigateTo("AccMan");
                }
                else
                {
                    new MessageDialog(ResourceManager.Current.MainResourceMap.GetValue("Resources/An_error_occurred_during_publication_creation").ValueAsString).ShowAsync();
                }

              }  
            }
        public async Task<bool> updatePublicationAsync(Publication pub)
        {
            HttpClient client = new HttpClient();

            string isOffer = (pub.Is_offer) ? "True" : "False";

            var values = new Dictionary<string, string>
            {
               { "Publication_id", Convert.ToString(pub.Publication_id, CultureInfo.InvariantCulture) },
               { "Author_id", Convert.ToString(pub.Author_id, CultureInfo.InvariantCulture) },
               { "Category_label", pub.Category_label },
               { "Description", pub.Description },
               { "Email", pub.Email },
               { "Phone_number", pub.Phone_number },
               { "Province_label", pub.Province_label },
               { "Title", pub.Title},
               { "Is_offer", isOffer } 
            };

            var content = new FormUrlEncodedContent(values);

            string sPubId = Convert.ToString(pub.Publication_id, CultureInfo.InvariantCulture);
            HttpResponseMessage response = await client.PutAsync("http://helpngowebapi.azurewebsites.net/api/publications/?id=" + sPubId, content);

            return response.IsSuccessStatusCode;
        }