source: FarmatikoData/FarmatikoRepo/AdminRepo.cs@ 1454207

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

Change structure, Add repo, services & controllers

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[1454207]1using FarmatikoData.FarmatikoRepoInterfaces;
2using FarmatikoData.Models;
3using System;
4using System.Collections.Generic;
5using System.Linq;
6using System.Text;
7using System.Threading.Tasks;
8
9namespace FarmatikoData.FarmatikoRepo
10{
11 public class AdminRepo : IAdminRepo
12 {
13 private readonly FarmatikoDataContext _context;
14 public AdminRepo(FarmatikoDataContext context)
15 {
16 _context = context;
17 }
18
19 public async Task<IQueryable<RequestPharmacyHead>> GetClaimingRequests()
20 {
21 var reqs = await Task.Run(() => _context.PHRequests.OrderBy(x => x.Head.Name));
22 return reqs;
23 }
24
25 //GET
26 public async Task<IQueryable<PharmacyHead>> GetPharmacyHeads()
27 {
28 var PHeads = await Task.Run(() => _context.PharmacyHeads.OrderBy(x => x.Name));
29 return PHeads;
30 }
31 //POST
32 public async Task RemoveClaimRequest(RequestPharmacyHead req)
33 {
34 await Task.Run(() => _context.PHRequests.Remove(req));
35 await _context.SaveChangesAsync();
36 }
37 }
38}
Note: See TracBrowser for help on using the repository browser.