public DeleteCrop()
 {
     InitializeComponent();
     cropModel = new CropModel();
     handler = new GetAllCropsCompleted(LoadCropList);
     cropModel.GetAllCrops(new Action<List<CropModel>>(handler));
 }
 public CropDetails()
 {
     InitializeComponent();
     CropModel cropModel = new CropModel();
     GetAllCropsCompleted handler = new GetAllCropsCompleted(LoadCropList);
     cropModel.GetAllCrops(new Action<List<CropModel>>(handler));
 }
        public Journal()
        {
            InitializeComponent();

            CropModel cropModel = new CropModel();
            GetAllCropsCallback handler = new GetAllCropsCallback(GetAllCropsCompleted);
            cropModel.GetAllCrops(new Action<List<CropModel>>(handler));
        }
        private void deleteBtn_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Are you sure?", "Delete Item", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                CropModel cropModel = new CropModel();
                int id = ((CropModel)cropPicker.SelectedItem).Id;
                cropModel.DeleteCropById(id);

                cropModel.GetAllCrops(new Action<List<CropModel>>(handler));
            }
        }