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
  • FarmatikoServices/Services/AdminService.cs

    r1454207 r6f203af  
    55using System.Collections.Generic;
    66using System.Linq;
    7 using System.Text;
    87using System.Threading.Tasks;
    98
     
    1817        }
    1918
    20         public async Task<IQueryable<RequestPharmacyHead>> GetCalimingRequests()
     19        public async Task<IEnumerable<RequestPharmacyHead>> GetClaimingRequests()
    2120        {
    22             var req = await Task.Run(() => _adminRepo.GetClaimingRequests());
    23             return req;
     21            var req = await _adminRepo.GetClaimingRequests();
     22            if (req != null)
     23                return req;
     24            throw new Exception("No data is found.");
    2425        }
    2526
    26         public async Task<IQueryable<PharmacyHead>> GetPharmacyHeads()
     27        public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeads()
    2728        {
    28             var PHeads = await Task.Run(() => _adminRepo.GetPharmacyHeads());
    29             return PHeads;
     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.");
    3036        }
    3137
    32         public async Task RejectRequest(RequestPharmacyHead req)
     38        public bool RejectRequest(RequestPharmacyHead req)
    3339        {
    34             await _adminRepo.RemoveClaimRequest(req);
     40            if (req != null)
     41            {
     42                _adminRepo.RemoveClaimRequest(req);
     43                return true;
     44            }
     45            return false;
    3546        }
    3647    }
Note: See TracChangeset for help on using the changeset viewer.