Last change
on this file since db484c9 was db484c9, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago |
Fix bugs
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1454207] | 1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
| 2 | using FarmatikoData.Models;
|
---|
[6f203af] | 3 | using Microsoft.EntityFrameworkCore;
|
---|
[1454207] | 4 | using System;
|
---|
| 5 | using System.Collections.Generic;
|
---|
| 6 | using System.Linq;
|
---|
| 7 | using System.Text;
|
---|
| 8 | using System.Threading.Tasks;
|
---|
| 9 |
|
---|
| 10 | namespace FarmatikoData.FarmatikoRepo
|
---|
| 11 | {
|
---|
| 12 | public class AdminRepo : IAdminRepo
|
---|
| 13 | {
|
---|
| 14 | private readonly FarmatikoDataContext _context;
|
---|
| 15 | public AdminRepo(FarmatikoDataContext context)
|
---|
| 16 | {
|
---|
| 17 | _context = context;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
[6f203af] | 20 | public async Task<IEnumerable<RequestPharmacyHead>> GetClaimingRequests()
|
---|
[1454207] | 21 | {
|
---|
[6f203af] | 22 | var reqs = await _context.PHRequests.OrderBy(x => x.Head.Name).ToListAsync();
|
---|
[1454207] | 23 | return reqs;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | //GET
|
---|
[6f203af] | 27 | public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeads()
|
---|
[1454207] | 28 | {
|
---|
[db484c9] | 29 | var PHeads = await _context.PharmacyHeads
|
---|
| 30 | .Include(x => x.Medicines)
|
---|
| 31 | .Include(x => x.Pharmacies)
|
---|
| 32 | .OrderBy(x => x.Name)
|
---|
| 33 | .ToListAsync();
|
---|
[1454207] | 34 | return PHeads;
|
---|
| 35 | }
|
---|
| 36 | //POST
|
---|
[db484c9] | 37 | public async void RemoveClaimRequest(int Id)
|
---|
[1454207] | 38 | {
|
---|
[d23bf72] | 39 | var req = _context.PHRequests.Where(x => x.Id == Id).FirstOrDefault();
|
---|
[6f203af] | 40 | _context.PHRequests.Remove(req);
|
---|
[db484c9] | 41 | await _context.SaveChangesAsync();
|
---|
[1454207] | 42 | }
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.