public bool add(Message message)
 {
     using (MessageTrackingDBEntities db = new MessageTrackingDBEntities())
     {
         db.Message.Add(message);
         db.SaveChanges();
         return true;
     }
 }
Exemplo n.º 2
0
 public void AddSuccess()
 {
     IMessageRepository messageRepository = new MessageRepository();
     var message = new Message { Text = "Test message", Level = Level.Information };
     messageRepository.Add(message);
     Assert.IsNotNull(
         _mongoDatabase.GetCollection<Type.Message>("Message").FindOneByIdAs<Type.Message>(
             new ObjectId(message.Id.Value)));
 }
Exemplo n.º 3
0
 private void PrepareMessage(string text)
 {
     Message = new Domain.Message()
     {
         Text     = text,
         AuthorId = _sender.Id,
         Status   = MessageStatus.New,
     };
 }
Exemplo n.º 4
0
 /// <summary>
 /// Add a message
 /// </summary>
 /// <param name="message">Message to add</param>
 public void Add(Message message)
 {
     IMongoCollection<Message> messages = _mongo.Database.GetCollection<Message>();
     messages.Save(message);
 }
Exemplo n.º 5
0
 public IHttpActionResult PostMessage(int chatId, Message message)
 {
     ChatLog chatLog = Context.ChatLogs.FirstOrDefault(i => i.Id == chatId);
     if (chatLog == null)
     {
         return NotFound();
     }
     else
     {
         Context.Messages.Add(message);
         Context.SaveChanges();
         return Ok();
     }
 }
Exemplo n.º 6
0
 public void DelMessage(Message message)
 {
     context.Messages.Remove(message);
     context.SaveChanges();
 }
Exemplo n.º 7
0
 public void AddMessage(Message message)
 {
     context.Messages.Add(message);
     context.SaveChanges();
 }