source: Farmatiko/Controllers/MedicineListController.cs@ c406ae5

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

Update Models, Repos, Services and Controllers

  • Property mode set to 100644
File size: 1.5 KB
Line 
1using System.Collections.Generic;
2using System.Linq;
3using System.Threading.Tasks;
4using FarmatikoData.Models;
5using FarmatikoServices.FarmatikoServiceInterfaces;
6using Microsoft.AspNetCore.Mvc;
7
8namespace Farmatiko.Controllers
9{
10 [ApiController]
11 [Route("[controller]/[action]")]
12 public class MedicineListController : Controller
13 {
14 private IMedicineListService _medicineListService;
15 public MedicineListController(IMedicineListService medicineListService)
16 {
17 _medicineListService = medicineListService;
18 }
19 [HttpGet]
20 public Task<IQueryable<MedicineList>> Get()
21 {
22 return _medicineListService.GetAll();
23 }
24 [HttpGet]
25 public Task<ICollection<MedicineList>> GetByName(string Name)
26 {
27 return _medicineListService.GetByName(Name);
28 }
29 [HttpGet]
30 public Task<ICollection<MedicineList>> GetByManufacturer(string Manufacturer)
31 {
32 return _medicineListService.GetByManufacturer(Manufacturer);
33 }
34 /*[HttpPost]
35 public void SetHasMedicine(MedicineList medicineList, bool HasMedicine)
36 {
37 _medicineListService.SetHasMedicine(medicineList, HasMedicine);
38 }*/
39 [HttpPost]
40 public void Add(MedicineList medicineList)
41 {
42 _medicineListService.Add(medicineList);
43 }
44 [HttpPost]
45 public void Remove(MedicineList medicineList)
46 {
47 _medicineListService.Remove(medicineList);
48 }
49 }
50}
Note: See TracBrowser for help on using the repository browser.