Ignore:
Timestamp:
10/28/20 22:06:48 (2 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
993189e
Parents:
1454207
Message:

Change methods & add error controller

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoServices/Services/Service.cs

    r1454207 r6f203af  
    33using FarmatikoServices.FarmatikoServiceInterfaces;
    44using System;
     5using System.Collections.Generic;
    56using System.Linq;
    67using System.Threading.Tasks;
     
    1718
    1819        //GET
    19         public async Task<IQueryable<HealthcareWorker>> GetAllWorkers()
     20        public async Task<IEnumerable<HealthcareWorker>> GetAllWorkers()
    2021        {
    2122            var Workers = await _repository.GetAllWorkers();
     
    2324        }
    2425
    25         public async Task<IQueryable<HealthFacility>> GetFacilities()
     26        public async Task<IEnumerable<HealthFacility>> GetFacilities()
    2627        {
    2728            var Facilities = await _repository.GetFacilities();
     
    4142        }
    4243
    43         public async Task<IQueryable<Medicine>> GetMedicines()
     44        public async Task<IEnumerable<Medicine>> GetMedicines()
    4445        {
    4546            var Medicines = await _repository.GetMedicines();
     
    5354        }
    5455
    55         public async Task<IQueryable<Pharmacy>> GetPharmacies()
     56        public async Task<IEnumerable<Pharmacy>> GetPharmacies()
    5657        {
    5758            var Pharmacies = await _repository.GetPharmacies();
     
    7172        }
    7273
    73         public async Task<IQueryable<HealthFacility>> SearchFacilities(string query)
     74        public async Task<IEnumerable<HealthFacility>> SearchFacilities(string query)
    7475        {
    7576            var SearchQuery = await _repository.SearchFacilities(query);
     
    7778        }
    7879
    79         public async Task<IQueryable<Medicine>> SearchMedicines(string query)
     80        public async Task<IEnumerable<Medicine>> SearchMedicines(string query)
    8081        {
    8182            var SearchQuery = await _repository.SearchMedicines(query);
     
    8384        }
    8485
    85         public async Task<IQueryable<Pharmacy>> SearchPharmacies(string query)
     86        public async Task<IEnumerable<Pharmacy>> SearchPharmacies(string query)
    8687        {
    8788            var SearchQuery = await _repository.SearchPharmacies(query);
     
    8990        }
    9091
    91         public async Task<IQueryable<HealthcareWorker>> SearchWorkers(string query)
     92        public async Task<IEnumerable<HealthcareWorker>> SearchWorkers(string query)
    9293        {
    9394            var SearchQuery = await _repository.SearchWorkers(query);
     
    202203        }
    203204
    204         public async Task RemovePharmacyHead(PharmacyHead pharmacyHead)
    205         {
    206             if (pharmacyHead != null)
     205        public async Task RemovePharmacyHead(int Id)
     206        {
     207            if (Id > 0)
    207208            {
    208                 pharmacyHead.DeletedOn = DateTime.UtcNow;
    209                 await _repository.RemovePharmacyHead(pharmacyHead);
     209                await _repository.RemovePharmacyHead(Id);
    210210            }
    211             else throw new Exception("PharmacyHead is null.");
     211            throw new Exception("Index out of bounds.");
    212212        }
    213213
Note: See TracChangeset for help on using the changeset viewer.