public OpexCategory UpdateOpexCategory(OpexCategory opexCategory)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                IOpexCategoryRepository opexCategoryRepository = _DataRepositoryFactory.GetDataRepository <IOpexCategoryRepository>();

                OpexCategory updatedEntity = null;

                if (opexCategory.OpexCategoryId == 0)
                {
                    updatedEntity = opexCategoryRepository.Add(opexCategory);
                }
                else
                {
                    updatedEntity = opexCategoryRepository.Update(opexCategory);
                }

                return updatedEntity;
            }));
        }
        public OpexCategory GetOpexCategory(int opexCategoryId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                IOpexCategoryRepository opexCategoryRepository = _DataRepositoryFactory.GetDataRepository <IOpexCategoryRepository>();

                OpexCategory opexCategoryEntity = opexCategoryRepository.Get(opexCategoryId);
                if (opexCategoryEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("OpexCategory with ID of {0} is not in database", opexCategoryId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return opexCategoryEntity;
            }));
        }
Пример #3
0
 public OpexCategory UpdateOpexCategory(OpexCategory opexCategory)
 {
     return(Channel.UpdateOpexCategory(opexCategory));
 }