source: FarmatikoServices/Services/AdminService.cs@ ad60966

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

Add SystemService, Auth, fix a lil bugs :)

  • Property mode set to 100644
File size: 1.3 KB
Line 
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
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.