示例#1
0
        private async void Save_Clicked(object sender, EventArgs e)
        {
            var imageArr = FromFile.ToArray(file.GetStream());
            var movie    = new Movie()
            {
                Name        = EntName.Text,
                Description = EntDescription.Text,
                Language    = EntLanguage.Text,
                Duration    = EntDuration.Text,
                PlayingDate = EntPlayingDate.Text,
                PlayingTime = EntPlayingTime.Text,
                TicketPrice = EntTicketPrice.Text,
                Rating      = Convert.ToDouble(EntRating.Text),
                Genre       = EntGenre.Text,

                TrailorUrl = EntTrailorUrl.Text,
                ImageArray = imageArr
            };
            var response = await ApiServices.AddMovie(file, movie);

            if (!response)
            {
                await DisplayAlert("Error occured", "Something went wrong, Could not be added", "Cancel");
            }
            else
            {
                await DisplayAlert("Success", "Movie added successfully", "Ok");

                await Navigation.PopModalAsync();
            }
        }