Exemplo n.º 1
0
 public MessageDTO(Message messageToConvert)
 {
     this.MessageId = messageToConvert.MessageId;
     this.Body = messageToConvert.Body;
     this.UserId = messageToConvert.UserId;
     this.EventId = messageToConvert.EventId;
     this.Deleted = messageToConvert.Deleted;
 }
Exemplo n.º 2
0
        public HttpResponseMessage CreateMessage(Message messageToAdd)
        {
            messageToAdd.UserId = userService.GetUserIdByUsername(User.Identity.Name);
            messageToAdd.Deleted = false;
            messageToAdd.TimeCreated = DateTime.Now;

            messageService.CreateMessage(messageToAdd);
            messageToAdd.User = userService.GetUserById(messageToAdd.UserId);

            var responnse = Request.CreateResponse(HttpStatusCode.Created, messageToAdd);

            return responnse;
        }