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

    r4e72684 ra55ef91  
    33using FarmatikoServices.FarmatikoServiceInterfaces;
    44using System;
    5 using System.Collections.Generic;
     5using System.Linq;
    66
    77namespace FarmatikoServices.Services
     
    1717        public void Add(Pandemic pandemic)
    1818        {
    19             _pandemicRepository.Add(pandemic);
     19            try
     20            {
     21                if (pandemic != null)
     22                {
     23                    _pandemicRepository.Add(pandemic);
     24                }
     25            }
     26            catch (Exception e)
     27            {
     28                e = new Exception("Can't add pandemic is null.");
     29                throw e;
     30            }
    2031        }
    2132
    22         public IEnumerable<Pandemic> GetAll()
     33        public IQueryable<Pandemic> GetAll()
    2334        {
    2435            return _pandemicRepository.GetAll();
     
    2738        public void Remove(Pandemic pandemic)
    2839        {
    29             _pandemicRepository.Remove(pandemic);
     40            try
     41            {
     42                if (pandemic != null)
     43                    _pandemicRepository.Remove(pandemic);
     44            }
     45            catch (Exception e)
     46            {
     47                e = new Exception("Can't remove, pandemic is null.");
     48            }
    3049        }
    3150    }
Note: See TracChangeset for help on using the changeset viewer.