Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoServices/Services/PandemicService.cs

    rc406ae5 ra55ef91  
    44using System;
    55using System.Linq;
    6 using System.Threading.Tasks;
    76
    87namespace FarmatikoServices.Services
     
    1615        }
    1716
    18         public async void Add(Pandemic pandemic)
     17        public void Add(Pandemic pandemic)
    1918        {
    20             if (pandemic != null)
    21                 await Task.Run(() => _pandemicRepository.Add(pandemic));
    22             else throw new Exception("Can't add pandemic is null.");
     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            }
    2331        }
    2432
    25         public async Task<IQueryable<Pandemic>> GetAll()
     33        public IQueryable<Pandemic> GetAll()
    2634        {
    27             return await Task.Run(() => _pandemicRepository.GetAll());
     35            return _pandemicRepository.GetAll();
    2836        }
    2937
    30         public async void Remove(Pandemic pandemic)
     38        public void Remove(Pandemic pandemic)
    3139        {
    32             if (pandemic != null)
    33                 await Task.Run(() => _pandemicRepository.Remove(pandemic));
    34             else throw new Exception("Can't remove, pandemic is null.");
     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            }
    3549        }
    3650    }
Note: See TracChangeset for help on using the changeset viewer.