source: FarmatikoServices/Services/AdminService.cs

Last change on this file was e0cdea2, checked in by Dimitar Slezenkovski <dslezenkovski@…>, 22 months ago

Fix all bugs

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[1454207]1using FarmatikoData.FarmatikoRepoInterfaces;
2using FarmatikoData.Models;
3using FarmatikoServices.FarmatikoServiceInterfaces;
4using System;
5using System.Collections.Generic;
6using System.Linq;
7using System.Threading.Tasks;
8
9namespace FarmatikoServices.Services
10{
11 public class AdminService : IAdminService
12 {
13 private readonly IAdminRepo _adminRepo;
14 public AdminService(IAdminRepo adminRepo)
15 {
16 _adminRepo = adminRepo;
17 }
18
[6f203af]19 public async Task<IEnumerable<RequestPharmacyHead>> GetClaimingRequests()
[1454207]20 {
[6f203af]21 var req = await _adminRepo.GetClaimingRequests();
22 if (req != null)
23 return req;
24 throw new Exception("No data is found.");
[1454207]25 }
26
[6f203af]27 public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeads()
[1454207]28 {
[6f203af]29 var PHeads = await _adminRepo.GetPharmacyHeads();
30 var list = PHeads.Select(x => x.DeletedOn == null);
31 if (list != null)
32 {
33 return PHeads;
34 }
35 throw new Exception("No data is found.");
[1454207]36 }
37
[e0cdea2]38 public bool RejectRequest(RequestPharmacyHead req)
[1454207]39 {
[e0cdea2]40 if (req != null)
[6f203af]41 {
[e0cdea2]42 _adminRepo.RemoveClaimRequest(req);
[6f203af]43 return true;
44 }
45 return false;
[1454207]46 }
47 }
48}
Note: See TracBrowser for help on using the repository browser.