コード例 #1
0
ファイル: MessageDTO.cs プロジェクト: JotaAlava/EventHub1.1
 public MessageDTO(Message messageToConvert)
 {
     this.MessageId = messageToConvert.MessageId;
     this.Body = messageToConvert.Body;
     this.UserId = messageToConvert.UserId;
     this.EventId = messageToConvert.EventId;
     this.Deleted = messageToConvert.Deleted;
 }
コード例 #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;
        }