Beispiel #1
0
        static async void AddIceCreams()
        {
            //var a = new IceCream { Name = "Magnum", Flavour = "Chocolat", Description = "Awesome ice cream", Energy = 230, Fat = 20, Sugar = 20, AverageRate = 5, ImageURL = "C:/Users/gabri/Pictures/11.jpg", Ratings = new List<Rating> { new Rating { Author = "Gab", Rate = 5, Description = "Top" } } };

            var a = bl.GetAllIceCreams();

            var f = a[0];

            f.Name = "Chcco";
            f.Ratings.Add(new Rating {
                Author = "Gabriel 28/5"
            });

            await bl.UpdateIceCream(f);

            a = bl.GetAllIceCreams();

            foreach (var item in a)
            {
                Console.WriteLine($"{item.ID} {item.Name} {item.Ratings.Count}");
            }

            //bl.AddIceCream(a);
        }
Beispiel #2
0
        private async void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            iceCreamList.Add(currentIceCream);
            currentIceCream.Shop = currentShop;

            await bL.UpdateIceCream(currentIceCream);

            currentIceCream             = new IceCream();
            stkpAddIceCream.DataContext = currentIceCream;

            txtBtnAddPicture.Visibility = Visibility.Visible;
            pgbImage.Visibility         = Visibility.Hidden;
            btnAdd.IsEnabled            = false;

            imgAddImageBkg.Source         = null;
            btnAddPicture.BorderThickness = new Thickness(1);
            btnAddPicture.BorderBrush     = Brushes.Purple;
        }
Beispiel #3
0
        private async void btnAddRate_Click(object sender, RoutedEventArgs e)
        {
            currentRating.Rate = ratingBar.Value;

            selectedIceCream.Ratings.Add(currentRating);
            selectedIceCream.AverageRate = selectedIceCream.Ratings.Average(x => x.Rate);

            await bL.UpdateIceCream(selectedIceCream);

            ListViewIceCreamsRatings.ItemsSource = null;
            UpdateIceCreamSelected();

            ratingBar.Value     = 0;
            txtAverageRate.Text = Math.Round(selectedIceCream.AverageRate, 1).ToString();

            currentRating            = new Rating();
            stkpRating.DataContext   = currentRating;
            btnAddPicture.Background = Brushes.Purple;
        }