public HttpResponseMessage UpdateCollateralType(HttpRequestMessage request, [FromBody] CollateralType collateralTypeModel) { return(GetHttpResponse(request, () => { var collateralType = _LoanService.UpdateCollateralType(collateralTypeModel); return request.CreateResponse <CollateralType>(HttpStatusCode.OK, collateralType); })); }
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; })); }
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); } }
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)); }