Beispiel #1
0
        public Message Create(Message message)
        {
            using (var client = Server.OpenClient())
            {
                message.Id = message.GetHashCode();

                message.From = client.Query<User>(u => u.Id == message.From.Id).SingleOrDefault();
                message.To = client.Query<User>(u => u.Id == message.To.Id).SingleOrDefault();

                client.Store(message);
            }

            return message;
        }
Beispiel #2
0
        public JsonResult Create(string text, int userId)
        {
            var message = new Message()
            {
                CreatedOn = DateTime.Now,
                From = LoggedUser,
                Text = text,
                To = accountService.GetUser(userId)
            };

            message = messageService.Create(message);

            return Json(message);
        }
Beispiel #3
0
 public Message Create(Message message)
 {
     return messageRepository.Create(message);
 }