Ignore:
Timestamp:
10/01/20 03:17:09 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
6f203af
Parents:
5d02859
Message:

Change structure, Add repo, services & controllers

Location:
Farmatiko/Controllers
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/Controllers/FarmatikoController.cs

    r5d02859 r1454207  
    2020        [HttpGet]
    2121        [Route("/api/workers")]
    22         public async Task<IQueryable<HealthcareWorkers>> GetWorkers()
     22        public async Task<IQueryable<HealthcareWorker>> GetWorkers()
    2323        {
    24             return await _service.GetAllWorkers();
     24            var Workers =  await _service.GetAllWorkers();
     25            return Workers;
    2526        }
    2627        [HttpGet]
    2728        [Route("/api/workers/search/{Query}")]
    28         public async Task<IQueryable<HealthcareWorkers>> SearchWorkers(string Query)
     29        public async Task<IQueryable<HealthcareWorker>> SearchWorkers(string Query)
    2930        {
    3031            return await _service.SearchWorkers(Query);
     
    3233        [HttpGet]
    3334        [Route("/api/workers/{id}")]
    34         public async Task<HealthcareWorkers> GetWorker(int Id)
     35        public async Task<HealthcareWorker> GetWorker(int Id)
    3536        {
    3637            return await _service.GetWorker(Id);
     
    4344        [HttpGet]
    4445        [Route("/api/facilities")]
    45         public async Task<IQueryable<HealthFacilities>> GetFacilities()
     46        public async Task<IQueryable<HealthFacility>> GetFacilities()
    4647        {
    4748            return await _service.GetFacilities();
     
    4950        [HttpGet]
    5051        [Route("/api/facilities/search/{Query}")]
    51         public async Task<IQueryable<HealthFacilities>> SearchFacilities(string Query)
     52        public async Task<IQueryable<HealthFacility>> SearchFacilities(string Query)
    5253        {
    5354            return await _service.SearchFacilities(Query);
     
    5556        [HttpGet]
    5657        [Route("/api/facilities/{Id}")]
    57         public async Task<HealthFacilities> GetFacility(int Id)
     58        public async Task<HealthFacility> GetFacility(int Id)
    5859        {
    5960            return await _service.GetFacility(Id);
  • Farmatiko/Controllers/PharmacyHeadController.cs

    r5d02859 r1454207  
    11using System.Linq;
     2using System.Threading.Tasks;
    23using FarmatikoData.FarmatikoRepoInterfaces;
    34using FarmatikoData.Models;
     5using FarmatikoServices.FarmatikoServiceInterfaces;
    46using Microsoft.AspNetCore.Mvc;
    57
     
    1012    public class PharmacyHeadController : Controller
    1113    {
    12         private readonly IPharmacyHeadRepository _pharmacyHeadRepository;
    13         public PharmacyHeadController(IPharmacyHeadRepository pharmacyHeadRepository)
     14        private readonly IPHService _PHService;
     15        public PharmacyHeadController(IPHService PHService)
    1416        {
    15             _pharmacyHeadRepository = pharmacyHeadRepository;
     17            _PHService = PHService;
    1618        }
     19       
     20        //GET
     21        //Mi trebaat rutite
    1722        [HttpGet]
    18         public IQueryable<PharmacyHead> GetAllPharmacies(string NameOfPharmacy)
     23        public async Task<IQueryable<PharmacyHead>> GetPharmacyHeadInfo(string Token)
    1924        {
    20             return _pharmacyHeadRepository.GetAllPharmacies(NameOfPharmacy);
     25            return await _PHService.GetPharmacyHeadInfo(Token);
    2126        }
    22         [HttpGet]
    23         public IQueryable<PharmacyHead> GetPharmacyByName(string Name)
     27        //POST
     28        [HttpPost]
     29        public async Task<int> Login(PharmacyHead pharmacyHead)
    2430        {
    25             return _pharmacyHeadRepository.GetPharmacyByName(Name);
    26         }
    27         [HttpGet]
    28         public IQueryable<MedicineList> GetPharmacyMedicines(string NameOfPharmacy)
    29         {
    30             return _pharmacyHeadRepository.GetPharmacyMedicines(NameOfPharmacy);
     31            return await _PHService.Login(pharmacyHead);
    3132        }
    3233        [HttpPost]
    33         public void Add(PharmacyHead pharmacyHead)
     34        public async Task UpdatePharmacyHead(PharmacyHead pharmacyHead)
    3435        {
    35             _pharmacyHeadRepository.Add(pharmacyHead);
     36            await _PHService.UpdatePharmacyHead(pharmacyHead);
    3637        }
    3738        [HttpPost]
    38         public void Remove(PharmacyHead pharmacyHead)
     39        public async Task<IActionResult> ClaimPharmacy(RequestPharmacyHead pharmacy)
    3940        {
    40             _pharmacyHeadRepository.Remove(pharmacyHead);
     41            await _PHService.ClaimPharmacy(pharmacy);
     42            return Ok();
    4143        }
     44       
    4245    }
    4346}
Note: See TracChangeset for help on using the changeset viewer.