public MessageViewModel(Message message) { Text = message.Text; Created = message.CreatedTime; ReciverId = message.ReceiverId; SenderId = message.SenderId; SenderEmail = message.Sender.UserName; ReciverEmail = message.Receiver.UserName; }
public void AddMessage(Message message) { using (var context = new DataBaseContext()) { message.CreatedTime = DateTime.UtcNow; context.Messages.Add(message); context.SaveChanges(); } }
public void AddMessage(Message message) { messageRepository.AddMessage(message); }