Last change
on this file since ee137aa was a55ef91, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago |
Update & add service
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[a55ef91] | 1 | using System.Collections.Generic;
|
---|
[4e72684] | 2 | using System.Linq;
|
---|
| 3 | using FarmatikoData.Models;
|
---|
| 4 | using FarmatikoServices.FarmatikoServiceInterfaces;
|
---|
| 5 | using Microsoft.AspNetCore.Mvc;
|
---|
| 6 |
|
---|
| 7 | namespace 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]
|
---|
[a55ef91] | 19 | public IQueryable<Pharmacy> Get()
|
---|
[4e72684] | 20 | {
|
---|
| 21 | return _pharmacyService.GetAll();
|
---|
| 22 | }
|
---|
[a55ef91] | 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 | }
|
---|
[4e72684] | 43 | }
|
---|
| 44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.