Ignore:
Timestamp:
11/05/20 06:57:35 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
afc9a9a
Parents:
1f4846d
Message:

Add SystemService, Auth, fix a lil bugs :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/Controllers/PharmacyHeadController.cs

    r1f4846d rd23bf72  
    1 using System.Collections;
    2 using System.Collections.Generic;
    3 using System.Linq;
     1using System.Collections.Generic;
    42using System.Threading.Tasks;
    5 using FarmatikoData.FarmatikoRepoInterfaces;
    63using FarmatikoData.Models;
    74using FarmatikoServices.FarmatikoServiceInterfaces;
     5using Microsoft.AspNetCore.Authorization;
    86using Microsoft.AspNetCore.Mvc;
    97
     
    119{
    1210    [ApiController]
     11    [Authorize(Roles = "PharmacyHead")]
    1312    public class PharmacyHeadController : Controller
    1413    {
     
    2019
    2120        //GET
    22         //Mi trebaat rutite
    23         [HttpGet]
     21        /*[HttpGet]
    2422        [Route("api/pharmacyhead")]
    25         public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeadInfo(string Token)
     23        public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeadInfo()
    2624        {
    27             var PHeads = await _PHService.GetPharmacyHeadInfo(Token);
     25            var PHeads = await _PHService.GetPharmacyHeadInfo();
    2826            return PHeads;
    29         }
     27        }*/
    3028        [HttpGet]
    3129        [Route("api/pharmacyhead/{Id}")]
    32         public async Task<PharmacyHead> GetPharmacyHeadById(int Id)
     30        public async Task<PharmacyHead> GetPharmacyHeadById([FromRoute]int Id)
    3331        {
    3432            var Phead = await _PHService.GetPharmacyHeadByIdAsync(Id);
     
    3836        [HttpPost]
    3937        [Route("api/pharmacyhead/add")]
    40         public async Task<IActionResult> AddPharmacyHead(PharmacyHead pharmacyHead)
     38        public async Task<IActionResult> AddPharmacyHead([FromBody]PharmacyHead pharmacyHead)
    4139        {
    4240            bool Success = await _PHService.Add(pharmacyHead);
     
    4442        }
    4543
    46         [HttpPost]
     44        /*[HttpPost]
    4745        [Route("api/pharmacyhead/login")]
    4846        public async Task<int> Login([FromBody]PharmacyHead pharmacyHead)
    4947        {
    5048            return await _PHService.Login(pharmacyHead);
    51         }
     49        }*/
    5250        [HttpPut]
    5351        [Route("api/pharmacyhead/{Id}")]
     
    5856        [HttpPost]
    5957        [Route("api/pharmacyhead/requests")]
    60         public async Task<IActionResult> ClaimPharmacy(RequestPharmacyHead pharmacy)
     58        public async Task<IActionResult> ClaimPharmacy([FromBody]RequestPharmacyHead pharmacy)
    6159        {
    6260            bool Success = await _PHService.ClaimPharmacy(pharmacy);
     
    6563        [HttpDelete]
    6664        [Route("api/pharmacyhead/delete/{Id}")]
    67         public async Task<IActionResult> Remove([FromQuery] int Id)
     65        public async Task<IActionResult> Remove([FromRoute] int Id)
    6866        {
    6967            bool Success = await _PHService.Remove(Id);
     
    7270        [HttpPost]
    7371        [Route("api/pharmacyhead/requests/{Id}")]
    74         public async Task<IActionResult> RemoveClaimingRequest([FromQuery] int Id)
     72        public async Task<IActionResult> RemoveClaimingRequest([FromRoute] int Id)
    7573        {
    7674            bool Success = await _PHService.RemoveClaimingRequest(Id);
Note: See TracChangeset for help on using the changeset viewer.