source: Farmatiko/Controllers/HealthFacilitiesController.cs@ d2e69be

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

Add Route Attribute

  • Property mode set to 100644
File size: 1.1 KB
Line 
1using FarmatikoData;
2using FarmatikoData.Models;
3using Microsoft.AspNetCore.Mvc;
4using System.Collections.Generic;
5
6namespace Farmatiko.Controllers
7{
8 [ApiController]
9 [Route("[controller]/[action]")]
10 public class HealthFacilitiesController : Controller
11 {
12 private IHealthFacilityService _healthFacilitiesService;
13 public HealthFacilitiesController(IHealthFacilityService healthFacilitiesService)
14 {
15 _healthFacilitiesService = healthFacilitiesService;
16 }
17 [HttpGet]
18 public IEnumerable<HealthFacilities> Get()
19 {
20 return _healthFacilitiesService.GetAll();
21 }
22 [HttpGet]
23 public IEnumerable<HealthFacilities> GetByName(string Name)
24 {
25 return _healthFacilitiesService.GetByName(Name);
26 }
27
28 [HttpGet]
29 public IEnumerable<HealthFacilities> GetByType(string Type)
30 {
31 return _healthFacilitiesService.GetByType(Type);
32 }
33 [HttpPut]
34 public void Add(HealthFacilities healthFacility)
35 {
36 _healthFacilitiesService.Add(healthFacility);
37 }
38 }
39}
Note: See TracBrowser for help on using the repository browser.