Ignore:
Timestamp:
10/28/20 22:06:48 (2 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
993189e
Parents:
1454207
Message:

Change methods & add error controller

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoData/FarmatikoRepo/AdminRepo.cs

    r1454207 r6f203af  
    11using FarmatikoData.FarmatikoRepoInterfaces;
    22using FarmatikoData.Models;
     3using Microsoft.EntityFrameworkCore;
    34using System;
    45using System.Collections.Generic;
     
    1718        }
    1819
    19         public async Task<IQueryable<RequestPharmacyHead>> GetClaimingRequests()
     20        public async Task<IEnumerable<RequestPharmacyHead>> GetClaimingRequests()
    2021        {
    21             var reqs = await Task.Run(() => _context.PHRequests.OrderBy(x => x.Head.Name));
     22            var reqs = await _context.PHRequests.OrderBy(x => x.Head.Name).ToListAsync();
    2223            return reqs;
    2324        }
    2425
    2526        //GET
    26         public async Task<IQueryable<PharmacyHead>> GetPharmacyHeads()
     27        public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeads()
    2728        {
    28             var PHeads = await Task.Run(() => _context.PharmacyHeads.OrderBy(x => x.Name));
     29            var PHeads = await _context.PharmacyHeads.OrderBy(x => x.Name).ToListAsync();
    2930            return PHeads;
    3031        }
    3132        //POST
    32         public async Task RemoveClaimRequest(RequestPharmacyHead req)
     33        public void RemoveClaimRequest(RequestPharmacyHead req)
    3334        {
    34             await Task.Run(() => _context.PHRequests.Remove(req));
    35             await _context.SaveChangesAsync();
     35            _context.PHRequests.Remove(req);
     36            _context.SaveChanges();
    3637        }
    3738    }
Note: See TracChangeset for help on using the changeset viewer.