Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoServices/Services/HealthFacilityService.cs

    rc406ae5 ra55ef91  
    44using System;
    55using System.Linq;
    6 using System.Threading.Tasks;
    76
    87namespace FarmatikoServices
     
    1716        }
    1817
    19         public async void Add(HealthFacilities healthFacility)
     18        public void Add(HealthFacilities healthFacility)
    2019        {
    21             if (healthFacility != null)
    22                 await Task.Run(() => _healthFacilityRepository.Add(healthFacility));
    23             else throw new Exception("Can't add, health facility is null");
     20            try
     21            {
     22                if (healthFacility != null)
     23                    _healthFacilityRepository.Add(healthFacility);
     24            }
     25            catch (Exception e)
     26            {
     27                e = new Exception("Can't Add health facility is null");
     28                throw e;
     29            }
    2430        }
    2531
    26         public async Task<IQueryable<HealthFacilities>> GetAll()
     32        public IQueryable<HealthFacilities> GetAll()
    2733        {
    28             return await Task.Run(() => _healthFacilityRepository.GetAll());
     34            return _healthFacilityRepository.GetAll();
    2935        }
    3036
    31         public async void Remove(HealthFacilities healthFacility)
     37        public void Remove(HealthFacilities healthFacility)
    3238        {
    33             if (healthFacility != null)
    34                 await Task.Run(() => _healthFacilityRepository.Remove(healthFacility));
    35             else throw new Exception("Can't Remove health facility is null");
    36 
     39            try
     40            {
     41                if (healthFacility != null)
     42                    _healthFacilityRepository.Remove(healthFacility);
     43            }
     44            catch(Exception e)
     45            {
     46                e = new Exception("Can't Remove health facility is null");
     47                throw e;
     48            }
    3749        }
    3850    }
Note: See TracChangeset for help on using the changeset viewer.