示例#1
0
        public IFRSRegistry UpdateIFRSRegistry(IFRSRegistry ifrsRegistry)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    IFRSCoreModuleDefinition.GROUP_ADMINISTRATOR
                };
                AllowAccessToOperation(IFRSCoreModuleDefinition.SOLUTION_NAME, groupNames);

                IIFRSRegistryRepository ifrsRegistryRepository = _DataRepositoryFactory.GetDataRepository <IIFRSRegistryRepository>();

                IFRSRegistry updatedEntity = null;

                if (ifrsRegistry.RegistryId == 0)
                {
                    updatedEntity = ifrsRegistryRepository.Add(ifrsRegistry);
                }
                else
                {
                    updatedEntity = ifrsRegistryRepository.Update(ifrsRegistry);
                }

                return updatedEntity;
            }));
        }
        public HttpResponseMessage UpdateIFRSRegistry(HttpRequestMessage request, [FromBody] IFRSRegistry registryModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var registry = _IFRSCoreService.UpdateIFRSRegistry(registryModel);

                return request.CreateResponse <IFRSRegistry>(HttpStatusCode.OK, registry);
            }));
        }
        public HttpResponseMessage GetIFRSRegistry(HttpRequestMessage request, int registryId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                IFRSRegistry registry = _IFRSCoreService.GetIFRSRegistry(registryId);

                // notice no need to create a seperate model object since IFRSRegistry entity will do just fine
                response = request.CreateResponse <IFRSRegistry>(HttpStatusCode.OK, registry);

                return response;
            }));
        }
示例#4
0
        public IFRSRegistry GetIFRSRegistry(int ifrsRevenueId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    IFRSCoreModuleDefinition.GROUP_ADMINISTRATOR, IFRSCoreModuleDefinition.GROUP_USER
                };
                AllowAccessToOperation(IFRSCoreModuleDefinition.SOLUTION_NAME, groupNames);

                IIFRSRegistryRepository ifrsRegistryRepository = _DataRepositoryFactory.GetDataRepository <IIFRSRegistryRepository>();

                IFRSRegistry ifrsRegistryEntity = ifrsRegistryRepository.Get(ifrsRevenueId);
                if (ifrsRegistryEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("IFRSRegistry with ID of {0} is not in database", ifrsRevenueId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return ifrsRegistryEntity;
            }));
        }
        public HttpResponseMessage DeleteIFRSRegistry(HttpRequestMessage request, [FromBody] int registryId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                IFRSRegistry registry = _IFRSCoreService.GetIFRSRegistry(registryId);

                if (registry != null)
                {
                    _IFRSCoreService.DeleteIFRSRegistry(registryId);

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No registry found under that ID.");
                }

                return response;
            }));
        }
 public IFRSRegistry UpdateIFRSRegistry(IFRSRegistry ifrsRegistry)
 {
     return(Channel.UpdateIFRSRegistry(ifrsRegistry));
 }