public Message Create(CreateMessageCommand command) { var message = new Message(command.BodyMessage, command.Destination, command.Date, command.IdUser, false); message.Validate(); _repository.Create(message); if (Commit()) return message; return null; }
public Task<HttpResponseMessage> Post([FromBody]dynamic body) { var commandMessage = new CreateMessageCommand( bodyMessage: (string)body.bodyMessage, destination: (string)body.destination, date: DateTime.Now, idUser: (string)body.idUser ); var message = _serviceMessage.Create(commandMessage); return CreateResponse(HttpStatusCode.Created, message); }