source: Farmatiko/Controllers/PharmacyController.cs@ c406ae5

Last change on this file since c406ae5 was c406ae5, checked in by DimitarSlezenkovski <dslezenkovski@…>, 2 years ago

Update Models, Repos, Services and Controllers

  • Property mode set to 100644
File size: 1.2 KB
Line 
1using System.Collections.Generic;
2using System.Linq;
3using System.Threading.Tasks;
4using FarmatikoData.Models;
5using FarmatikoServices.FarmatikoServiceInterfaces;
6using Microsoft.AspNetCore.Mvc;
7
8namespace Farmatiko.Controllers
9{
10 [ApiController]
11 [Route("[controller]/[action]")]
12 public class PharmacyController : Controller
13 {
14 private IPharmacyService _pharmacyService;
15 public PharmacyController(IPharmacyService pharmacyService)
16 {
17 _pharmacyService = pharmacyService;
18 }
19 [HttpGet]
20 public Task<IQueryable<Pharmacy>> Get()
21 {
22 return _pharmacyService.GetAll();
23 }
24 [HttpGet]
25 public Task<ICollection<Pharmacy>> GetPharmacies()
26 {
27 return _pharmacyService.GetPharmacies();
28 }
29 [HttpPost]
30 public void UpdatePharmacy(Pharmacy pharmacy)
31 {
32 _pharmacyService.UpdatePharmacy(pharmacy);
33 }
34 [HttpPost]
35 public void AddPharmacy(Pharmacy pharmacy)
36 {
37 _pharmacyService.Add(pharmacy);
38 }
39 [HttpPost]
40 public void RemovePharmacy(Pharmacy pharmacy)
41 {
42 _pharmacyService.Remove(pharmacy);
43 }
44 }
45}
Note: See TracBrowser for help on using the repository browser.