Ignore:
Timestamp:
08/05/20 18:39:58 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
63d885e
Parents:
a6bbad1
Message:

Update Models, Repos, Services and Controllers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoServices/Services/HealthFacilityService.cs

    ra6bbad1 rc406ae5  
    44using System;
    55using System.Linq;
     6using System.Threading.Tasks;
    67
    78namespace FarmatikoServices
     
    1617        }
    1718
    18         public void Add(HealthFacilities healthFacility)
     19        public async void Add(HealthFacilities healthFacility)
    1920        {
    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             }
     21            if (healthFacility != null)
     22                await Task.Run(() => _healthFacilityRepository.Add(healthFacility));
     23            else throw new Exception("Can't add, health facility is null");
    3024        }
    3125
    32         public IQueryable<HealthFacilities> GetAll()
     26        public async Task<IQueryable<HealthFacilities>> GetAll()
    3327        {
    34             return _healthFacilityRepository.GetAll();
     28            return await Task.Run(() => _healthFacilityRepository.GetAll());
    3529        }
    3630
    37         public void Remove(HealthFacilities healthFacility)
     31        public async void Remove(HealthFacilities healthFacility)
    3832        {
    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             }
     33            if (healthFacility != null)
     34                await Task.Run(() => _healthFacilityRepository.Remove(healthFacility));
     35            else throw new Exception("Can't Remove health facility is null");
     36
    4937        }
    5038    }
Note: See TracChangeset for help on using the changeset viewer.