Line | |
---|
1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
2 | using FarmatikoData.Models;
|
---|
3 | using Microsoft.EntityFrameworkCore;
|
---|
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 |
|
---|
20 | public async Task<IEnumerable<RequestPharmacyHead>> GetClaimingRequests()
|
---|
21 | {
|
---|
22 | var reqs = await _context.PHRequests.OrderBy(x => x.Head.Name).ToListAsync();
|
---|
23 | return reqs;
|
---|
24 | }
|
---|
25 |
|
---|
26 | //GET
|
---|
27 | public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeads()
|
---|
28 | {
|
---|
29 | var PHeads = await _context.PharmacyHeads.OrderBy(x => x.Name).ToListAsync();
|
---|
30 | return PHeads;
|
---|
31 | }
|
---|
32 | //POST
|
---|
33 | public void RemoveClaimRequest(int Id)
|
---|
34 | {
|
---|
35 | var req = _context.PHRequests.Where(x => x.Id == Id).FirstOrDefault();
|
---|
36 | _context.PHRequests.Remove(req);
|
---|
37 | _context.SaveChanges();
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.