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
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
[d23bf72]38 public bool RejectRequest(int Id)
[1454207]39 {
[d23bf72]40 if (Id >= 0)
[6f203af]41 {
[d23bf72]42 _adminRepo.RemoveClaimRequest(Id);
[6f203af]43 return true;
44 }
45 return false;
[1454207]46 }
47 }
48}
Note: See TracBrowser for help on using the repository browser.