示例#1
0
        async void BookBtn_Click(object sender, EventArgs e)
        {
            description = descriptionTV.Text;

            dateString = dateTV.Text;



            foreach (Booking booking in band.Bookings)
            {
                if (booking.Date.ToString("yyyy-MM-dd") == dateString)
                {
                    Toast.MakeText(this, "Sorry, this artist is not available in the date you selected", ToastLength.Long).Show();
                    return;
                }
            }
            int result = await MusicoConnUtil.AddBooking(description, Convert.ToDateTime(dateString), userId, band.Id);

            if (result < 0)
            {
                Toast.MakeText(this, "An error has ocurred, please try again", ToastLength.Short).Show();
                return;
            }

            Toast.MakeText(this, "You have booked this artist!", ToastLength.Long).Show();
            Intent intent = new Intent(this, typeof(HomeActivity));

            intent.PutExtra("id", userId);
            StartActivity(intent);
            Finish();
        }