예제 #1
0
        public void SaveMessage(Model.Message message, Domain.User user)
        {
            var messagesRepo = new Domain.MessageRepository();
            var usersRepo = new Domain.UserRepository();

            //a new message has been sent to the server
            message.SentDate = DateTime.Now;

            message.Username = user.Username;
            message.SenderId = user.Id.ToString();
            message.AvatarId = user.Avatar.ToString();

            //Save the message to the db
            var messageDto = MapClientMessageToDomain(message);

            messagesRepo.InsertMessage(messageDto);

            message.Id = messageDto.Id.ToString();
        }