Ignore:
Timestamp:
07/31/20 10:15:02 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
d8fafb8
Parents:
4e72684
Message:

Update & add service

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoServices/Services/HealthFacilityService.cs

    r4e72684 ra55ef91  
    22using FarmatikoData.FarmatikoRepoInterfaces;
    33using FarmatikoData.Models;
    4 using System.Collections.Generic;
     4using System;
    55using System.Linq;
    66
     
    1818        public void Add(HealthFacilities healthFacility)
    1919        {
    20             _healthFacilityRepository.Add(healthFacility);
     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            }
    2130        }
    2231
    23         public IEnumerable<HealthFacilities> GetAll()
     32        public IQueryable<HealthFacilities> GetAll()
    2433        {
    2534            return _healthFacilityRepository.GetAll();
    2635        }
     36
     37        public void Remove(HealthFacilities healthFacility)
     38        {
     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            }
     49        }
    2750    }
    2851}
Note: See TracChangeset for help on using the changeset viewer.