Beispiel #1
0
        public void Save(Action<int> callback)
        {
            try
            {
                CropSaveCallback handler = new CropSaveCallback(SaveCompleted);
                CropRepository cropRep = new CropRepository();
                ViewCallback = callback;

                cropRep.saveCropData(new Func<int,int>(handler), this);
            }
            catch (Exception e)
            {
                Console.WriteLine("Crop save: " + e.StackTrace);
            }
        }
Beispiel #2
0
        public void GetAllCrops(Action<List<CropModel>> callback)
        {
            try
            {
                CropGetAllCallback handler = new CropGetAllCallback(GetAllCropsCompleted);
                CropRepository cropRep = new CropRepository();
                ViewGetAllCropsCallback = callback;

                cropRep.getAllCrops(new Action<List<CropModel>>(handler));
            }
            catch (Exception e)
            {
                Console.WriteLine("Crop save: " + e.StackTrace);
            }
        }
Beispiel #3
0
 public void GetCropById(Action<CropModel> callback, int id)
 {
     try
     {
         ViewGetCropByIdCallback = callback;
         CropRepository cropRep = new CropRepository();
         CropGetByIdCallback handler = new CropGetByIdCallback(GetCropByIdCompleted);
         cropRep.getCropDataById(new Action<CropModel>(handler), id);
     }
     catch (Exception e)
     {
         Console.WriteLine("Crop get by id: " + e.StackTrace);
     }
 }
Beispiel #4
0
 public void DeleteCropById(int id)
 {
     try
     {
         CropRepository cropRep = new CropRepository();
         cropRep.deleteCropById(id);
     }
     catch (Exception e)
     {
         Console.WriteLine("Crop delete by id: " + e.StackTrace);
     }
 }