예제 #1
0
        private async void ImgSave_Tapped(object sender, EventArgs e)
        {
            var imageArray = FromFile.ToArray(file.GetStream());
            var movie      = new Movie()
            {
                Name        = EntMovieName.Text,
                Description = EdtDescription.Text,
                Language    = EntLanguage.Text,
                Duration    = EntDuration.Text,
                PlayingDate = EntPlayingDate.Text,
                PlayingTime = EntPlayingTime.Text,
                TicketPrice = Convert.ToInt32(EntTicketPrice.Text),
                Rating      = Convert.ToDouble(EntRating.Text),
                Genre       = EntGenre.Text,
                TrailorUrl  = EntTrailorUrl.Text,
                ImageArray  = imageArray
            };

            var response = await ApiService.AddMovie(file, movie);

            if (!response)
            {
                await DisplayAlert("Oops", "Something went wrong", "Cancel");
            }
            else
            {
                await DisplayAlert("", "Movie has been added", "Alright");

                await Navigation.PopModalAsync();
            }
        }