public Task <HttpResponseMessage> Post([FromBody] dynamic body) { var command = new CreatePaymentToCompanyCommand( idCompany: (int)body.idCompany, value: (decimal)body.value, datePayment: (DateTime)body.datePayment, description: (string)body.description ); var payment = _service.Create(command); return(CreateResponse(HttpStatusCode.Created, payment)); }
public PaymentToCompany Create(CreatePaymentToCompanyCommand command) { var payment = new PaymentToCompany(command.IdCompany, command.Value, command.DatePayment, command.Description); payment.Create(); _repository.Create(payment); if (Commit()) { return(payment); } return(null); }