source: Farmatiko/Controllers/PharmacyController.cs@ a55ef91

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

Update & add service

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