public TeamSetting UpdateTeamSetting(TeamSetting teamSetting) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); ITeamSettingRepository teamSettingRepository = _DataRepositoryFactory.GetDataRepository <ITeamSettingRepository>(); TeamSetting updatedEntity = null; if (teamSetting.TeamSettingId == 0) { updatedEntity = teamSettingRepository.Add(teamSetting); } else { updatedEntity = teamSettingRepository.Update(teamSetting); } return updatedEntity; })); }
public void DeleteTeamSetting(int teamSettingId) { ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); ITeamSettingRepository teamSettingRepository = _DataRepositoryFactory.GetDataRepository <ITeamSettingRepository>(); teamSettingRepository.Remove(teamSettingId); }); }
public TeamSetting[] GetAllTeamSettings() { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); ITeamSettingRepository teamSettingRepository = _DataRepositoryFactory.GetDataRepository <ITeamSettingRepository>(); IEnumerable <TeamSetting> teamSettings = teamSettingRepository.Get().ToArray(); return teamSettings.ToArray(); })); }
public TeamSetting GetTeamSetting(int teamSettingId) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); ITeamSettingRepository teamSettingRepository = _DataRepositoryFactory.GetDataRepository <ITeamSettingRepository>(); TeamSetting teamSettingEntity = teamSettingRepository.Get(teamSettingId); if (teamSettingEntity == null) { NotFoundException ex = new NotFoundException(string.Format("TeamSetting with ID of {0} is not in database", teamSettingId)); throw new FaultException <NotFoundException>(ex, ex.Message); } return teamSettingEntity; })); }