Beispiel #1
0
 public void AddItem_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (foodnametxt.Text == "" || Descriptiontxt.Text == "" || pricetxt.Text == "")
         {
             status.Foreground = Brushes.Red;
             status.Content    = "Усі поля обов'язкові.";
         }
         else
         {
             _rVmObj = new RestaurantViewModel();
             FoodItems fooditem = new FoodItems();
             fooditem.FoodName    = foodnametxt.Text;
             fooditem.Description = Descriptiontxt.Text;
             fooditem.fPrice      = Convert.ToInt32(pricetxt.Text.ToString());
             _rVmObj.AddFoodItem(fooditem);
             DataContext       = new RestaurantViewModel();
             status.Foreground = Brushes.Green;
             status.Content    = "Страва успішно додана.";
         }
     }
     catch (Exception exp)
     {
         status.Foreground = Brushes.Red;
         status.Content    = "Введіть значення.";
     }
 }
 private void AddItem_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (foodnametxt.Text == "" || descriptiontxt.Text == "" || pricetxt.Text == "")
         {
             status.Foreground = Brushes.Red;
             status.Content    = "Alanlar boş bırakılamaz";
         }
         else
         {
             _rVmObj = new RestaurantViewModel();
             FoodItems fooditem = new FoodItems();
             fooditem.FoodName    = foodnametxt.Text;
             fooditem.Description = descriptiontxt.Text;
             fooditem.fPrice      = Convert.ToInt32(pricetxt.Text.ToString());
             _rVmObj.AddFoodItem(fooditem);
             DataContext       = new RestaurantViewModel();
             status.Foreground = Brushes.Green;
             status.Content    = "Ürün başarılı bir şekilde eklendi.";
         }
     }
     catch (Exception exp)
     {
         status.Foreground = Brushes.Red;
         status.Content    = "Girilen değerleri kontrol ediniz.";
     }
 }