Example #1
0
        public FairValueBasisExemption UpdateFairValueBasisExemption(FairValueBasisExemption fairValueBasisExemption)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    GROUP_ADMINISTRATOR
                };
                AllowAccessToOperation(SOLUTION_NAME, groupNames);

                IFairValueBasisExemptionRepository fairValueBasisExemptionRepository = _DataRepositoryFactory.GetDataRepository <IFairValueBasisExemptionRepository>();

                FairValueBasisExemption updatedEntity = null;

                if (fairValueBasisExemption.FairValueBasisExemptionId == 0)
                {
                    updatedEntity = fairValueBasisExemptionRepository.Add(fairValueBasisExemption);
                }
                else
                {
                    updatedEntity = fairValueBasisExemptionRepository.Update(fairValueBasisExemption);
                }

                return updatedEntity;
            }));
        }
        public HttpResponseMessage UpdateSetup(HttpRequestMessage request, [FromBody] FairValueBasisExemption fairValueBasisExemptionModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var fairValueBasisExemption = _FIService.UpdateFairValueBasisExemption(fairValueBasisExemptionModel);

                return request.CreateResponse <FairValueBasisExemption>(HttpStatusCode.OK, fairValueBasisExemption);
            }));
        }
        public HttpResponseMessage GetSetup(HttpRequestMessage request, int fairValueBasisExemptionId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                FairValueBasisExemption fairValueBasisExemption = _FIService.GetFairValueBasisExemption(fairValueBasisExemptionId);

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

                return response;
            }));
        }
Example #4
0
        public FairValueBasisExemption GetFairValueBasisExemption(int fairValueBasisExemptionId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    GROUP_ADMINISTRATOR, GROUP_USER
                };
                AllowAccessToOperation(SOLUTION_NAME, groupNames);

                IFairValueBasisExemptionRepository fairValueBasisExemptionRepository = _DataRepositoryFactory.GetDataRepository <IFairValueBasisExemptionRepository>();

                FairValueBasisExemption fairValueBasisExemptionEntity = fairValueBasisExemptionRepository.Get(fairValueBasisExemptionId);
                if (fairValueBasisExemptionEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("FairValueBasisExemption with ID of {0} is not in database", fairValueBasisExemptionId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return fairValueBasisExemptionEntity;
            }));
        }
        public HttpResponseMessage DeleteSetup(HttpRequestMessage request, [FromBody] int fairValueBasisExemptionId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                FairValueBasisExemption fairValueBasisExemption = _FIService.GetFairValueBasisExemption(fairValueBasisExemptionId);

                if (fairValueBasisExemption != null)
                {
                    _FIService.DeleteFairValueBasisExemption(fairValueBasisExemptionId);

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

                return response;
            }));
        }
 public FairValueBasisExemption UpdateFairValueBasisExemption(FairValueBasisExemption fairValueBasisExemption)
 {
     return(Channel.UpdateFairValueBasisExemption(fairValueBasisExemption));
 }