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

Change structure, Add repo, services & controllers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.