public MessageDTO(Message messageToConvert) { this.MessageId = messageToConvert.MessageId; this.Body = messageToConvert.Body; this.UserId = messageToConvert.UserId; this.EventId = messageToConvert.EventId; this.Deleted = messageToConvert.Deleted; }
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; }