source: Farmatiko/Controllers/MedicineListController.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.5 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 MedicineListController : Controller
12 {
13 private IMedicineListService _medicineListService;
14 public MedicineListController(IMedicineListService medicineListService)
15 {
16 _medicineListService = medicineListService;
17 }
18 [HttpGet]
19 public IQueryable<MedicineList> Get()
20 {
21 return _medicineListService.GetAll();
22 }
23 [HttpGet]
24 public ICollection<MedicineList> GetByName(string Name)
25 {
26 return _medicineListService.GetByName(Name);
27 }
28 [HttpGet]
29 public ICollection<MedicineList> GetByManufacturer(string Manufacturer)
30 {
31 return _medicineListService.GetByManufacturer(Manufacturer);
32 }
33 /*[HttpPost]
34 public void SetHasMedicine(MedicineList medicineList, bool HasMedicine)
35 {
36 _medicineListService.SetHasMedicine(medicineList, HasMedicine);
37 }*/
38 [HttpPost]
39 public void Add(MedicineList medicineList)
40 {
41 _medicineListService.Add(medicineList);
42 }
43 [HttpPost]
44 public void Remove(MedicineList medicineList)
45 {
46 _medicineListService.Remove(medicineList);
47 }
48 }
49}
Note: See TracBrowser for help on using the repository browser.