source: Farmatiko/Controllers/PharmacyController.cs@ c406ae5

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

Update Models, Repos, Services and Controllers

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[a55ef91]1using System.Collections.Generic;
[4e72684]2using System.Linq;
[c406ae5]3using System.Threading.Tasks;
[4e72684]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]
[c406ae5]20 public Task<IQueryable<Pharmacy>> Get()
[4e72684]21 {
22 return _pharmacyService.GetAll();
23 }
[a55ef91]24 [HttpGet]
[c406ae5]25 public Task<ICollection<Pharmacy>> GetPharmacies()
[a55ef91]26 {
27 return _pharmacyService.GetPharmacies();
28 }
29 [HttpPost]
[c406ae5]30 public void UpdatePharmacy(Pharmacy pharmacy)
[a55ef91]31 {
[c406ae5]32 _pharmacyService.UpdatePharmacy(pharmacy);
[a55ef91]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 }
[4e72684]44 }
45}
Note: See TracBrowser for help on using the repository browser.