Ignore:
Timestamp:
08/07/20 11:01:25 (4 years ago)
Author:
Mile Jankuloski <mile.jankuloski@…>
Branches:
master
Children:
5d02859
Parents:
ee137aa (diff), c406ae5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://develop.finki.ukim.mk/git/farmatiko

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoServices/Services/PandemicService.cs

    ree137aa r63d885e  
    44using System;
    55using System.Linq;
     6using System.Threading.Tasks;
    67
    78namespace FarmatikoServices.Services
     
    1516        }
    1617
    17         public void Add(Pandemic pandemic)
     18        public async void Add(Pandemic pandemic)
    1819        {
    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             }
     20            if (pandemic != null)
     21                await Task.Run(() => _pandemicRepository.Add(pandemic));
     22            else throw new Exception("Can't add pandemic is null.");
    3123        }
    3224
    33         public IQueryable<Pandemic> GetAll()
     25        public async Task<IQueryable<Pandemic>> GetAll()
    3426        {
    35             return _pandemicRepository.GetAll();
     27            return await Task.Run(() => _pandemicRepository.GetAll());
    3628        }
    3729
    38         public void Remove(Pandemic pandemic)
     30        public async void Remove(Pandemic pandemic)
    3931        {
    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             }
     32            if (pandemic != null)
     33                await Task.Run(() => _pandemicRepository.Remove(pandemic));
     34            else throw new Exception("Can't remove, pandemic is null.");
    4935        }
    5036    }
Note: See TracChangeset for help on using the changeset viewer.