source: Farmatiko/Controllers/FarmatikoController.cs@ 5d02859

Last change on this file since 5d02859 was 5d02859, checked in by DimitarSlezenkovski <dslezenkovski@…>, 2 years ago

Add new repo, service and controller

  • Property mode set to 100644
File size: 3.2 KB
Line 
1using System.Linq;
2using System.Threading.Tasks;
3using FarmatikoData.Models;
4using FarmatikoServices.FarmatikoServiceInterfaces;
5using Microsoft.AspNetCore.Mvc;
6
7namespace Farmatiko.Controllers
8{
9 [ApiController]
10 [Route("api/[action]")]
11 public class FarmatikoController : Controller
12 {
13 private readonly IService _service;
14 public FarmatikoController(IService service)
15 {
16 _service = service;
17 }
18 // Workers
19 //Get
20 [HttpGet]
21 [Route("/api/workers")]
22 public async Task<IQueryable<HealthcareWorkers>> GetWorkers()
23 {
24 return await _service.GetAllWorkers();
25 }
26 [HttpGet]
27 [Route("/api/workers/search/{Query}")]
28 public async Task<IQueryable<HealthcareWorkers>> SearchWorkers(string Query)
29 {
30 return await _service.SearchWorkers(Query);
31 }
32 [HttpGet]
33 [Route("/api/workers/{id}")]
34 public async Task<HealthcareWorkers> GetWorker(int Id)
35 {
36 return await _service.GetWorker(Id);
37 }
38 //Post
39
40
41 //Facilities
42 //Get
43 [HttpGet]
44 [Route("/api/facilities")]
45 public async Task<IQueryable<HealthFacilities>> GetFacilities()
46 {
47 return await _service.GetFacilities();
48 }
49 [HttpGet]
50 [Route("/api/facilities/search/{Query}")]
51 public async Task<IQueryable<HealthFacilities>> SearchFacilities(string Query)
52 {
53 return await _service.SearchFacilities(Query);
54 }
55 [HttpGet]
56 [Route("/api/facilities/{Id}")]
57 public async Task<HealthFacilities> GetFacility(int Id)
58 {
59 return await _service.GetFacility(Id);
60 }
61 //Post
62
63 //Medicine
64 //Get
65 [HttpGet]
66 [Route("/api/medicines")]
67 public async Task<IQueryable<Medicine>> GetMedicines()
68 {
69 return await _service.GetMedicines();
70 }
71 [HttpGet]
72 [Route("/api/medicines/search/{Query}")]
73 public async Task<IQueryable<Medicine>> SearchMedicines(string Query)
74 {
75 return await _service.SearchMedicines(Query);
76 }
77 [HttpGet]
78 [Route("/api/medicines/{Id}")]
79 public async Task<Medicine> GetMedicine(int Id)
80 {
81 return await _service.GetMedicine(Id);
82 }
83 //POST
84
85 //Pandemic
86 [HttpGet]
87 [Route("/api/pandemic")]
88 public async Task<Pandemic> GetPandemic()
89 {
90 return await _service.GetPandemic();
91 }
92 //Pharmacy
93 //GET
94 [HttpGet]
95 [Route("/api/pharmacy")]
96 public async Task<IQueryable<Pharmacy>> GetPharmacies()
97 {
98 return await _service.GetPharmacies();
99 }
100 [HttpGet]
101 [Route("/api/pharmacy/search/{Query}")]
102 public async Task<IQueryable<Pharmacy>> SearchPharmacies(string Query)
103 {
104 return await _service.SearchPharmacies(Query);
105 }
106 [HttpGet]
107 [Route("/api/pharmacy/{Id}")]
108 public async Task<Pharmacy> GetPharmacy(int Id)
109 {
110 return await _service.GetPharmacy(Id);
111 }
112
113 }
114}
Note: See TracBrowser for help on using the repository browser.