Line | |
---|
1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
2 | using FarmatikoData.Models;
|
---|
3 | using FarmatikoServices.FarmatikoServiceInterfaces;
|
---|
4 | using System;
|
---|
5 | using System.Collections.Generic;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Threading.Tasks;
|
---|
8 |
|
---|
9 | namespace 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 |
|
---|
19 | public async Task<IEnumerable<RequestPharmacyHead>> GetClaimingRequests()
|
---|
20 | {
|
---|
21 | var req = await _adminRepo.GetClaimingRequests();
|
---|
22 | if (req != null)
|
---|
23 | return req;
|
---|
24 | throw new Exception("No data is found.");
|
---|
25 | }
|
---|
26 |
|
---|
27 | public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeads()
|
---|
28 | {
|
---|
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.");
|
---|
36 | }
|
---|
37 |
|
---|
38 | public bool RejectRequest(int Id)
|
---|
39 | {
|
---|
40 | if (Id >= 0)
|
---|
41 | {
|
---|
42 | _adminRepo.RemoveClaimRequest(Id);
|
---|
43 | return true;
|
---|
44 | }
|
---|
45 | return false;
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.