示例#1
0
 public void AddDish(Dish d)
 {
     if (d.DishName == null)
     {
         throw new Exception("you must enter a name");
     }
     if (d.stars < 1 || d.stars > 5)
     {
         throw new Exception("the stars number is wrong");
     }
     if (d.DishPrice < d.stars * 5)
     {
         throw new Exception("the price is too cheap compare to the stars");
     }
     dal.AddDish(d);
 }