Exemple #1
0
        public DerivedCaption UpdateDerivedCaption(DerivedCaption derivedCaption)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    IFRSCoreModuleDefinition.GROUP_ADMINISTRATOR
                };
                AllowAccessToOperation(IFRSCoreModuleDefinition.SOLUTION_NAME, groupNames);

                IDerivedCaptionRepository derivedCaptionRepository = _DataRepositoryFactory.GetDataRepository <IDerivedCaptionRepository>();

                DerivedCaption updatedEntity = null;

                if (derivedCaption.DerivedCaptionId == 0)
                {
                    updatedEntity = derivedCaptionRepository.Add(derivedCaption);
                }
                else
                {
                    updatedEntity = derivedCaptionRepository.Update(derivedCaption);
                }

                return updatedEntity;
            }));
        }
        public HttpResponseMessage UpdateDerivedCaption(HttpRequestMessage request, [FromBody] DerivedCaption derivedCaptionModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var derivedCaption = _IFRSCoreService.UpdateDerivedCaption(derivedCaptionModel);

                return request.CreateResponse <DerivedCaption>(HttpStatusCode.OK, derivedCaption);
            }));
        }
        public HttpResponseMessage GetDerivedCaption(HttpRequestMessage request, int derivedCaptionId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                DerivedCaption derivedCaption = _IFRSCoreService.GetDerivedCaption(derivedCaptionId);

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

                return response;
            }));
        }
Exemple #4
0
        public DerivedCaption GetDerivedCaption(int derivedCaptionId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    IFRSCoreModuleDefinition.GROUP_ADMINISTRATOR, IFRSCoreModuleDefinition.GROUP_USER
                };
                AllowAccessToOperation(IFRSCoreModuleDefinition.SOLUTION_NAME, groupNames);

                IDerivedCaptionRepository derivedCaptionRepository = _DataRepositoryFactory.GetDataRepository <IDerivedCaptionRepository>();

                DerivedCaption derivedCaptionEntity = derivedCaptionRepository.Get(derivedCaptionId);
                if (derivedCaptionEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("DerivedCaption with ID of {0} is not in database", derivedCaptionId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return derivedCaptionEntity;
            }));
        }
        public HttpResponseMessage DeleteDerivedCaption(HttpRequestMessage request, [FromBody] int derivedCaptionId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                DerivedCaption derivedCaption = _IFRSCoreService.GetDerivedCaption(derivedCaptionId);

                if (derivedCaption != null)
                {
                    _IFRSCoreService.DeleteDerivedCaption(derivedCaptionId);

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

                return response;
            }));
        }
 public DerivedCaption UpdateDerivedCaption(DerivedCaption derivedCaption)
 {
     return(Channel.UpdateDerivedCaption(derivedCaption));
 }