source: Farmatiko/Controllers/PharmacyHeadController.cs@ 8b13eb2

Last change on this file since 8b13eb2 was 68454c6, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago

fix bugs

  • Property mode set to 100644
File size: 2.6 KB
Line 
1using System.Collections.Generic;
2using System.Threading.Tasks;
3using FarmatikoData.Models;
4using FarmatikoServices.FarmatikoServiceInterfaces;
5using Microsoft.AspNetCore.Authorization;
6using Microsoft.AspNetCore.Mvc;
7
8namespace Farmatiko.Controllers
9{
10 [ApiController]
11 [Authorize(Roles = "PharmacyHead,Admin")]
12 public class PharmacyHeadController : Controller
13 {
14 private readonly IPHService _PHService;
15 public PharmacyHeadController(IPHService PHService)
16 {
17 _PHService = PHService;
18 }
19
20 //GET
21 /*
22 [HttpGet]
23 [Route("api/pharmacyhead")]
24 public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeadInfo()
25 {
26 var PHeads = await _PHService.GetPharmacyHeadInfo();
27 return PHeads;
28 }*/
29
30 [HttpGet]
31 [Route("api/pharmacyhead/{Id}")]
32 public async Task<PharmacyHead> GetPharmacyHeadById([FromRoute]int Id)
33 {
34 var Phead = await _PHService.GetPharmacyHeadByIdAsync(Id);
35 return Phead;
36 }
37 //POST
38/*
39 [HttpPost]
40 [Route("api/pharmacyhead/add")]
41 public async Task<IActionResult> AddPharmacyHead([FromBody] PharmacyHead pharmacyHead)
42 {
43 bool Success = await _PHService.Add(pharmacyHead);
44 return Ok(Success);
45 }*/
46
47 /*[HttpPost]
48 [Route("api/pharmacyhead/login")]
49 public async Task<int> Login([FromBody]PharmacyHead pharmacyHead)
50 {
51 return await _PHService.Login(pharmacyHead);
52 }*/
53 [HttpPut]
54 [Route("api/pharmacyhead/update")]
55 public async Task UpdatePharmacyHead([FromBody]PharmacyHead pharmacyHead)
56 {
57 await _PHService.UpdatePharmacyHead(pharmacyHead);
58 }
59 [HttpPost]
60 [Route("api/pharmacyhead/requests")]
61 public async Task<IActionResult> ClaimPharmacy([FromBody]RequestPharmacyHead pharmacy)
62 {
63 bool Success = await _PHService.ClaimPharmacy(pharmacy);
64 return Ok(Success);
65 }
66 [HttpDelete]
67 [Route("api/pharmacyhead/delete/{Id}")]
68 public async Task<IActionResult> Remove([FromRoute] int Id)
69 {
70 bool Success = await _PHService.Remove(Id);
71 return Ok(Success);
72 }
73 [HttpPost]
74 [Route("api/pharmacyhead/requests/{Id}")]
75 public async Task<IActionResult> RemoveClaimingRequest([FromRoute] int Id)
76 {
77 bool Success = await _PHService.RemoveClaimingRequest(Id);
78 return Ok(Success);
79 }
80
81 }
82}
Note: See TracBrowser for help on using the repository browser.