public OfficerDetail[] GetAllOfficerDetails() { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IOfficerDetailRepository officerDetailRepository = _DataRepositoryFactory.GetDataRepository <IOfficerDetailRepository>(); IEnumerable <OfficerDetail> officerDetails = officerDetailRepository.Get().ToArray(); return officerDetails.ToArray(); })); }
public OfficerDetail GetOfficerDetail(int officerDetailId) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IOfficerDetailRepository officerDetailRepository = _DataRepositoryFactory.GetDataRepository <IOfficerDetailRepository>(); OfficerDetail officerDetailEntity = officerDetailRepository.Get(officerDetailId); if (officerDetailEntity == null) { NotFoundException ex = new NotFoundException(string.Format("OfficerDetail with ID of {0} is not in database", officerDetailId)); throw new FaultException <NotFoundException>(ex, ex.Message); } return officerDetailEntity; })); }