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.5 KB
|
Rev | Line | |
---|
[4e72684] | 1 | using System.Collections.Generic;
|
---|
[a55ef91] | 2 | using System.Linq;
|
---|
[c406ae5] | 3 | using System.Threading.Tasks;
|
---|
[4e72684] | 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 MedicineListController : Controller
|
---|
| 13 | {
|
---|
| 14 | private IMedicineListService _medicineListService;
|
---|
| 15 | public MedicineListController(IMedicineListService medicineListService)
|
---|
| 16 | {
|
---|
| 17 | _medicineListService = medicineListService;
|
---|
| 18 | }
|
---|
| 19 | [HttpGet]
|
---|
[c406ae5] | 20 | public Task<IQueryable<MedicineList>> Get()
|
---|
[4e72684] | 21 | {
|
---|
| 22 | return _medicineListService.GetAll();
|
---|
| 23 | }
|
---|
[a55ef91] | 24 | [HttpGet]
|
---|
[c406ae5] | 25 | public Task<ICollection<MedicineList>> GetByName(string Name)
|
---|
[a55ef91] | 26 | {
|
---|
| 27 | return _medicineListService.GetByName(Name);
|
---|
| 28 | }
|
---|
| 29 | [HttpGet]
|
---|
[c406ae5] | 30 | public Task<ICollection<MedicineList>> GetByManufacturer(string Manufacturer)
|
---|
[a55ef91] | 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 | }
|
---|
[4e72684] | 49 | }
|
---|
| 50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.