source: FarmatikoData/FarmatikoRepo/AdminRepo.cs@ 6f203af

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

Change methods & add error controller

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[1454207]1using FarmatikoData.FarmatikoRepoInterfaces;
2using FarmatikoData.Models;
[6f203af]3using Microsoft.EntityFrameworkCore;
[1454207]4using System;
5using System.Collections.Generic;
6using System.Linq;
7using System.Text;
8using System.Threading.Tasks;
9
10namespace 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 {
[6f203af]29 var PHeads = await _context.PharmacyHeads.OrderBy(x => x.Name).ToListAsync();
[1454207]30 return PHeads;
31 }
32 //POST
[6f203af]33 public void RemoveClaimRequest(RequestPharmacyHead req)
[1454207]34 {
[6f203af]35 _context.PHRequests.Remove(req);
36 _context.SaveChanges();
[1454207]37 }
38 }
39}
Note: See TracBrowser for help on using the repository browser.