Example #1
0
        private async void BtnConfirmReceipt_OnClicked(object sender, EventArgs e)
        {
            var imageArray = FromFile.ToArray(file.GetStream());

            var receipt = new Receipt()
            {
                UserId     = Preferences.Get("userId", 0),
                ShopId     = shopId,
                Price      = Convert.ToSingle(PriceInput.Text),
                ImageArray = imageArray
            };

            var response = await ApiService.AddReceipt(file, receipt);

            if (!response)
            {
                await DisplayAlert("Oops", "Something went wrong", "Cancel");
            }
            else
            {
                await DisplayAlert("Hurray!", "Your receipt is now forevered", "OK");

                await Navigation.PushModalAsync(new ReceiptsPage(Preferences.Get("userId", 0)));
            }
        }