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;
        }
Ejemplo n.º 2
0
        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);
        }