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
|
Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using System.Linq;
|
---|
3 | using System.Threading.Tasks;
|
---|
4 | using FarmatikoData.Models;
|
---|
5 | using FarmatikoServices.FarmatikoServiceInterfaces;
|
---|
6 | using Microsoft.AspNetCore.Mvc;
|
---|
7 |
|
---|
8 | namespace 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.