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

Change methods & add error controller

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/Controllers/FarmatikoController.cs

    r1454207 r6f203af  
    1 using System.Linq;
     1using System.Collections.Generic;
    22using System.Threading.Tasks;
    33using FarmatikoData.Models;
     
    88{
    99    [ApiController]
    10     [Route("api/[action]")]
    1110    public class FarmatikoController : Controller
    1211    {
     
    1918        //Get
    2019        [HttpGet]
    21         [Route("/api/workers")]
    22         public async Task<IQueryable<HealthcareWorker>> GetWorkers()
     20        [Route("api/workers")]
     21        public async Task<IEnumerable<HealthcareWorker>> GetWorkers()
    2322        {
    2423            var Workers =  await _service.GetAllWorkers();
     
    2625        }
    2726        [HttpGet]
    28         [Route("/api/workers/search/{Query}")]
    29         public async Task<IQueryable<HealthcareWorker>> SearchWorkers(string Query)
     27        [Route("api/workers/search/{Query}")]
     28        public async Task<IEnumerable<HealthcareWorker>> SearchWorkers(string Query)
    3029        {
    3130            return await _service.SearchWorkers(Query);
    3231        }
    3332        [HttpGet]
    34         [Route("/api/workers/{id}")]
     33        [Route("api/workers/{id}")]
    3534        public async Task<HealthcareWorker> GetWorker(int Id)
    3635        {
     
    4342        //Get
    4443        [HttpGet]
    45         [Route("/api/facilities")]
    46         public async Task<IQueryable<HealthFacility>> GetFacilities()
     44        [Route("api/facilities")]
     45        public async Task<IEnumerable<HealthFacility>> GetFacilities()
    4746        {
    4847            return await _service.GetFacilities();
    4948        }
    5049        [HttpGet]
    51         [Route("/api/facilities/search/{Query}")]
    52         public async Task<IQueryable<HealthFacility>> SearchFacilities(string Query)
     50        [Route("api/facilities/search/{Query}")]
     51        public async Task<IEnumerable<HealthFacility>> SearchFacilities(string Query)
    5352        {
    5453            return await _service.SearchFacilities(Query);
    5554        }
    5655        [HttpGet]
    57         [Route("/api/facilities/{Id}")]
     56        [Route("api/facilities/{Id}")]
    5857        public async Task<HealthFacility> GetFacility(int Id)
    5958        {
     
    6564        //Get
    6665        [HttpGet]
    67         [Route("/api/medicines")]
    68         public async Task<IQueryable<Medicine>> GetMedicines()
     66        [Route("api/medicines")]
     67        public async Task<IEnumerable<Medicine>> GetMedicines()
    6968        {
    7069            return await _service.GetMedicines();
    7170        }
    7271        [HttpGet]
    73         [Route("/api/medicines/search/{Query}")]
    74         public async Task<IQueryable<Medicine>> SearchMedicines(string Query)
     72        [Route("api/medicines/search/{Query}")]
     73        public async Task<IEnumerable<Medicine>> SearchMedicines(string Query)
    7574        {
    7675            return await _service.SearchMedicines(Query);
    7776        }
    7877        [HttpGet]
    79         [Route("/api/medicines/{Id}")]
     78        [Route("api/medicines/{Id}")]
    8079        public async Task<Medicine> GetMedicine(int Id)
    8180        {
    8281            return await _service.GetMedicine(Id);
    8382        }
    84         //POST
    85 
    8683        //Pandemic
    8784        [HttpGet]
    88         [Route("/api/pandemic")]
     85        [Route("api/pandemic")]
    8986        public async Task<Pandemic> GetPandemic()
    9087        {
     
    9491        //GET
    9592        [HttpGet]
    96         [Route("/api/pharmacy")]
    97         public async Task<IQueryable<Pharmacy>> GetPharmacies()
     93        [Route("api/pharmacy")]
     94        public async Task<IEnumerable<Pharmacy>> GetPharmacies()
    9895        {
    9996            return await _service.GetPharmacies();
    10097        }
    10198        [HttpGet]
    102         [Route("/api/pharmacy/search/{Query}")]
    103         public async Task<IQueryable<Pharmacy>> SearchPharmacies(string Query)
     99        [Route("api/pharmacy/search/{Query}")]
     100        public async Task<IEnumerable<Pharmacy>> SearchPharmacies(string Query)
    104101        {
    105102            return await _service.SearchPharmacies(Query);
    106103        }
    107104        [HttpGet]
    108         [Route("/api/pharmacy/{Id}")]
     105        [Route("api/pharmacy/{Id}")]
    109106        public async Task<Pharmacy> GetPharmacy(int Id)
    110107        {
Note: See TracChangeset for help on using the changeset viewer.