Changeset 6f203af for Farmatiko/Controllers
- Timestamp:
- 10/28/20 22:06:48 (4 years ago)
- Branches:
- master
- Children:
- 993189e
- Parents:
- 1454207
- Location:
- Farmatiko/Controllers
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/Controllers/AdminController.cs
r1454207 r6f203af 23 23 //GET 24 24 [HttpGet] 25 public async Task<IQueryable<PharmacyHead>> GetPharmacyHeads() 25 [Route("api/pharmacyhead")] 26 public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeads() 26 27 { 27 28 return await _adminService.GetPharmacyHeads(); … … 29 30 30 31 [HttpGet] 31 public async Task<IQueryable<RequestPharmacyHead>> GetClaimingRequests() 32 [Route("api/pharmacyhead/requests")] 33 public async Task<IEnumerable<RequestPharmacyHead>> GetClaimingRequests() 32 34 { 33 return await _adminService.GetC alimingRequests();35 return await _adminService.GetClaimingRequests(); 34 36 } 35 37 … … 37 39 //POST 38 40 [HttpPost] 41 [Route("api/pharmacyhead/add")] 39 42 public async Task<IActionResult> AddPharmacyHead(PharmacyHead pharmacyHead) 40 43 { … … 44 47 45 48 [HttpPost] 46 public async Task<IActionResult> RemovePharmacyHead(PharmacyHead pharmacyHead) 49 [Route("api/pharmacyhead/delete/{Id}")] 50 public async Task<IActionResult> RemovePharmacyHead([FromQuery]int Id) 47 51 { 48 await _service.RemovePharmacyHead( pharmacyHead);52 await _service.RemovePharmacyHead(Id); 49 53 return Ok(); 50 54 } 51 55 [HttpPost] 52 public async Task<IActionResult>RejectRequset(RequestPharmacyHead req)56 public IActionResult RejectRequset(RequestPharmacyHead req) 53 57 { 54 await_adminService.RejectRequest(req);55 return Ok( );58 bool Success = _adminService.RejectRequest(req); 59 return Ok(Success); 56 60 } 57 61 [HttpPost] -
Farmatiko/Controllers/FarmatikoController.cs
r1454207 r6f203af 1 using System. Linq;1 using System.Collections.Generic; 2 2 using System.Threading.Tasks; 3 3 using FarmatikoData.Models; … … 8 8 { 9 9 [ApiController] 10 [Route("api/[action]")]11 10 public class FarmatikoController : Controller 12 11 { … … 19 18 //Get 20 19 [HttpGet] 21 [Route(" /api/workers")]22 public async Task<I Queryable<HealthcareWorker>> GetWorkers()20 [Route("api/workers")] 21 public async Task<IEnumerable<HealthcareWorker>> GetWorkers() 23 22 { 24 23 var Workers = await _service.GetAllWorkers(); … … 26 25 } 27 26 [HttpGet] 28 [Route(" /api/workers/search/{Query}")]29 public async Task<I Queryable<HealthcareWorker>> SearchWorkers(string Query)27 [Route("api/workers/search/{Query}")] 28 public async Task<IEnumerable<HealthcareWorker>> SearchWorkers(string Query) 30 29 { 31 30 return await _service.SearchWorkers(Query); 32 31 } 33 32 [HttpGet] 34 [Route(" /api/workers/{id}")]33 [Route("api/workers/{id}")] 35 34 public async Task<HealthcareWorker> GetWorker(int Id) 36 35 { … … 43 42 //Get 44 43 [HttpGet] 45 [Route(" /api/facilities")]46 public async Task<I Queryable<HealthFacility>> GetFacilities()44 [Route("api/facilities")] 45 public async Task<IEnumerable<HealthFacility>> GetFacilities() 47 46 { 48 47 return await _service.GetFacilities(); 49 48 } 50 49 [HttpGet] 51 [Route(" /api/facilities/search/{Query}")]52 public async Task<I Queryable<HealthFacility>> SearchFacilities(string Query)50 [Route("api/facilities/search/{Query}")] 51 public async Task<IEnumerable<HealthFacility>> SearchFacilities(string Query) 53 52 { 54 53 return await _service.SearchFacilities(Query); 55 54 } 56 55 [HttpGet] 57 [Route(" /api/facilities/{Id}")]56 [Route("api/facilities/{Id}")] 58 57 public async Task<HealthFacility> GetFacility(int Id) 59 58 { … … 65 64 //Get 66 65 [HttpGet] 67 [Route(" /api/medicines")]68 public async Task<I Queryable<Medicine>> GetMedicines()66 [Route("api/medicines")] 67 public async Task<IEnumerable<Medicine>> GetMedicines() 69 68 { 70 69 return await _service.GetMedicines(); 71 70 } 72 71 [HttpGet] 73 [Route(" /api/medicines/search/{Query}")]74 public async Task<I Queryable<Medicine>> SearchMedicines(string Query)72 [Route("api/medicines/search/{Query}")] 73 public async Task<IEnumerable<Medicine>> SearchMedicines(string Query) 75 74 { 76 75 return await _service.SearchMedicines(Query); 77 76 } 78 77 [HttpGet] 79 [Route(" /api/medicines/{Id}")]78 [Route("api/medicines/{Id}")] 80 79 public async Task<Medicine> GetMedicine(int Id) 81 80 { 82 81 return await _service.GetMedicine(Id); 83 82 } 84 //POST85 86 83 //Pandemic 87 84 [HttpGet] 88 [Route(" /api/pandemic")]85 [Route("api/pandemic")] 89 86 public async Task<Pandemic> GetPandemic() 90 87 { … … 94 91 //GET 95 92 [HttpGet] 96 [Route(" /api/pharmacy")]97 public async Task<I Queryable<Pharmacy>> GetPharmacies()93 [Route("api/pharmacy")] 94 public async Task<IEnumerable<Pharmacy>> GetPharmacies() 98 95 { 99 96 return await _service.GetPharmacies(); 100 97 } 101 98 [HttpGet] 102 [Route(" /api/pharmacy/search/{Query}")]103 public async Task<I Queryable<Pharmacy>> SearchPharmacies(string Query)99 [Route("api/pharmacy/search/{Query}")] 100 public async Task<IEnumerable<Pharmacy>> SearchPharmacies(string Query) 104 101 { 105 102 return await _service.SearchPharmacies(Query); 106 103 } 107 104 [HttpGet] 108 [Route(" /api/pharmacy/{Id}")]105 [Route("api/pharmacy/{Id}")] 109 106 public async Task<Pharmacy> GetPharmacy(int Id) 110 107 { -
Farmatiko/Controllers/PharmacyHeadController.cs
r1454207 r6f203af 1 using System.Linq; 1 using System.Collections; 2 using System.Collections.Generic; 3 using System.Linq; 2 4 using System.Threading.Tasks; 3 5 using FarmatikoData.FarmatikoRepoInterfaces; … … 9 11 { 10 12 [ApiController] 11 [Route("api/[action]")]12 13 public class PharmacyHeadController : Controller 13 14 { … … 17 18 _PHService = PHService; 18 19 } 19 20 20 21 //GET 21 22 //Mi trebaat rutite 22 23 [HttpGet] 23 public async Task<IQueryable<PharmacyHead>> GetPharmacyHeadInfo(string Token) 24 [Route("api/pharmacyhead")] 25 public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeadInfo(string Token) 24 26 { 25 return await _PHService.GetPharmacyHeadInfo(Token); 27 var PHeads = await _PHService.GetPharmacyHeadInfo(Token); 28 return PHeads; 29 } 30 [HttpGet] 31 [Route("api/pharmacyhead/{Id}")] 32 public async Task<PharmacyHead> GetPharmacyHeadById(int Id) 33 { 34 var Phead = await _PHService.GetPharmacyHeadByIdAsync(Id); 35 return Phead; 26 36 } 27 37 //POST 28 38 [HttpPost] 29 public async Task<int> Login(PharmacyHead pharmacyHead) 39 [Route("api/pharmacyhead/add")] 40 public async Task<IActionResult> AddPharmacyHead(PharmacyHead pharmacyHead) 41 { 42 bool Success = await _PHService.Add(pharmacyHead); 43 return Ok(Success); 44 } 45 46 [HttpPost] 47 [Route("api/pharmacyhead/login")] 48 public async Task<int> Login([FromBody]PharmacyHead pharmacyHead) 30 49 { 31 50 return await _PHService.Login(pharmacyHead); 32 51 } 33 [HttpPost] 34 public async Task UpdatePharmacyHead(PharmacyHead pharmacyHead) 52 [HttpPut] 53 [Route("api/pharmacyhead/{Id}")] 54 public async Task UpdatePharmacyHead([FromBody]PharmacyHead pharmacyHead) 35 55 { 36 56 await _PHService.UpdatePharmacyHead(pharmacyHead); 37 57 } 38 58 [HttpPost] 59 [Route("api/pharmacyhead/requests")] 39 60 public async Task<IActionResult> ClaimPharmacy(RequestPharmacyHead pharmacy) 40 61 { 41 await _PHService.ClaimPharmacy(pharmacy); 42 return Ok(); 62 bool Success = await _PHService.ClaimPharmacy(pharmacy); 63 return Ok(Success); 64 } 65 [HttpDelete] 66 [Route("api/pharmacyhead/delete/{Id}")] 67 public async Task<IActionResult> Remove([FromQuery] int Id) 68 { 69 bool Success = await _PHService.Remove(Id); 70 return Ok(Success); 71 } 72 [HttpPost] 73 [Route("api/pharmacyhead/requests/{Id}")] 74 public async Task<IActionResult> RemoveClaimingRequest([FromQuery] int Id) 75 { 76 bool Success = await _PHService.RemoveClaimingRequest(Id); 77 return Ok(Success); 43 78 } 44 79
Note:
See TracChangeset
for help on using the changeset viewer.