示例#1
0
        public HttpResponseMessage UpdateCollateralType(HttpRequestMessage request, [FromBody] CollateralType collateralTypeModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var collateralType = _LoanService.UpdateCollateralType(collateralTypeModel);

                return request.CreateResponse <CollateralType>(HttpStatusCode.OK, collateralType);
            }));
        }
示例#2
0
        public HttpResponseMessage GetCollateralType(HttpRequestMessage request, int collateralTypeId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                CollateralType collateralType = _LoanService.GetCollateralType(collateralTypeId);

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

                return response;
            }));
        }
示例#3
0
        public CollateralSettings Get(CollateralType collateralType)
        {
            switch (collateralType)
            {
            case CollateralType.Gold:
                return(GoldCollateralSettings);

            case CollateralType.Car:
                return(CarCollateralSettings);

            case CollateralType.Goods:
                return(GoodCollateralSettings);

            case CollateralType.Machinery:
                return(MachineryCollateralSettings);

            default:
                throw new ArgumentOutOfRangeException(nameof(collateralType), collateralType, null);
            }
        }
示例#4
0
        public HttpResponseMessage DeleteCollateralType(HttpRequestMessage request, [FromBody] int collateralTypeId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                CollateralType collateralType = _LoanService.GetCollateralType(collateralTypeId);

                if (collateralType != null)
                {
                    _LoanService.DeleteCollateralType(collateralTypeId);

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

                return response;
            }));
        }
 public CollateralType UpdateCollateralType(CollateralType collateralType)
 {
     return(Channel.UpdateCollateralType(collateralType));
 }