public object Post(ServicePaymentFormModel model) { try { tbPayment payment = model.ConvertModelToPayment(); var createdObj = PaymentFormMock.Instancia().Create(payment); var result = model.ConvertPaymentToModel(createdObj); if (result.id != 0) { return(Request.CreateResponse(HttpStatusCode.Created, result)); } return(Request.CreateResponse(HttpStatusCode.BadRequest)); } catch (Exception ex) { log.Error("Mensaje de Error: " + ex.Message); if (ex.InnerException != null) { log.Error("Inner exception: " + ex.InnerException.Message); } throw ex; } }
public object Get(int id) { try { ServicePaymentFormModel model = new ServicePaymentFormModel(); listaMock = PaymentFormMock.Instancia().Get(id); var result = model.ConvertListPaymentToListModel(listaMock); if (result != null) { return(Request.CreateResponse(HttpStatusCode.OK, result)); } return(Request.CreateResponse(HttpStatusCode.NotFound)); } catch (Exception ex) { log.Error("Mensaje de Error: " + ex.Message); if (ex.InnerException != null) { log.Error("Inner exception: " + ex.InnerException.Message); } throw ex; } }