public StaffCost[] GetAllStaffCosts() { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IStaffCostRepository staffCostRepository = _DataRepositoryFactory.GetDataRepository <IStaffCostRepository>(); IEnumerable <StaffCost> staffCosts = staffCostRepository.Get().ToArray(); return staffCosts.ToArray(); })); }
public StaffCost GetStaffCost(int staffCostId) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IStaffCostRepository staffCostRepository = _DataRepositoryFactory.GetDataRepository <IStaffCostRepository>(); StaffCost staffCostEntity = staffCostRepository.Get(staffCostId); if (staffCostEntity == null) { NotFoundException ex = new NotFoundException(string.Format("StaffCost with ID of {0} is not in database", staffCostId)); throw new FaultException <NotFoundException>(ex, ex.Message); } return staffCostEntity; })); }