public ItemDetailPage(PlaylistViewModel playlist) { InitializeComponent(); Playlist = playlist; Songs = playlist.Songs; BindingContext = this; }
async void Save_Clicked(object sender, EventArgs e) { var client = new HttpClient(); var pl = new PlaylistViewModel() { Name = Item.Text }; var myContent = JsonConvert.SerializeObject(pl); var buffer = System.Text.Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = await client.PostAsync($"http://{Storage.Ip}:{Storage.Port}/api/playlist/create?userId=" + Storage.User.ID, byteContent); Storage.Playlists.Add(pl); Application.Current.MainPage = new MainPage(); //MessagingCenter.Send(this, "AddItem", Item); //await Navigation.PopModalAsync(); }