Exemplo n.º 1
0
        private async void btnAddWine_Click(object sender, EventArgs e)
        {
            var winName          = tbWineName.Text;
            var producer         = tbProducer.Text;
            var selectedDistrict = (DistrictResponse)cbOriginDistrict.SelectedItem;
            var alcohol          = tbAlcohol.Text;

            if (string.IsNullOrEmpty(winName) || selectedDistrict == null || selectedDistrict.DistrictId <= 0)
            {
                MessageBox.Show("vinnamnet och distrikt är oligatoriska!", "Fel");
                return;
            }

            var addWineResponse = await Infrastructure.AddWine(winName, producer, selectedDistrict.DistrictId, alcohol, AddedGrapes, pbWineImage.Image);

            if (!addWineResponse.ErrorCode && !string.IsNullOrEmpty(addWineResponse.Message))
            {
                MessageBox.Show(addWineResponse.Message, "Fel");
            }
        }