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/HealthcareWorkerService.cs

    r4e72684 ra55ef91  
    1 using FarmatikoData.FarmatikoRepo;
    2 using FarmatikoData.FarmatikoRepoInterfaces;
     1using FarmatikoData.FarmatikoRepoInterfaces;
    32using FarmatikoData.Models;
    43using FarmatikoServices.FarmatikoServiceInterfaces;
    54using System;
    6 using System.Collections.Generic;
    7 using System.Text;
     5using System.Linq;
    86
    97namespace FarmatikoServices.Services
     
    1816        public void Add(HealthcareWorkers healthcareWorker)
    1917        {
    20             _healthcareWorkerRepo.Add(healthcareWorker);
     18            try
     19            {
     20                if (healthcareWorker != null)
     21                    _healthcareWorkerRepo.Add(healthcareWorker);
     22            }
     23            catch (Exception e)
     24            {
     25                e = new Exception("Can't Add healthcare worker is null");
     26                throw e;
     27            }
    2128        }
    2229
    23         public IEnumerable<HealthcareWorkers> GetAll()
     30        public IQueryable<HealthcareWorkers> GetAll()
    2431        {
    2532            return _healthcareWorkerRepo.GetAll();
    2633        }
     34
     35        public void Remove(HealthcareWorkers healthcareWorker)
     36        {
     37            try
     38            {
     39                if (healthcareWorker != null)
     40                    _healthcareWorkerRepo.Remove(healthcareWorker);
     41            }
     42            catch (Exception e)
     43            {
     44                e = new Exception("Can't Remove healthcare worker is null");
     45                throw e;
     46            }
     47        }
    2748    }
    2849}
Note: See TracChangeset for help on using the changeset viewer.