public AddBillChargeResponse Add(AddBillChargeRequest request) { try { var response = new AddBillChargeResponse(); var bc = new BillChargeComponent(); response.Result = bc.Add(request.Bill, request.Charge); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, // UNPROCESSABLE ENTITY ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
public GetBillChargeResponse GetById(int idBill, int idCharge) { try { var response = new GetBillChargeResponse(); var bc = new BillChargeComponent(); response.Result = bc.GetById(idBill, idCharge); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }