public bool add(Message message)
 {
     using (MessageTrackingDBEntities db = new MessageTrackingDBEntities())
     {
         db.Message.Add(message);
         db.SaveChanges();
         return true;
     }
 }
Пример #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)));
 }
Пример #3
0
 private void PrepareMessage(string text)
 {
     Message = new Domain.Message()
     {
         Text     = text,
         AuthorId = _sender.Id,
         Status   = MessageStatus.New,
     };
 }
Пример #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);
 }
Пример #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();
     }
 }
Пример #6
0
 public void DelMessage(Message message)
 {
     context.Messages.Remove(message);
     context.SaveChanges();
 }
Пример #7
0
 public void AddMessage(Message message)
 {
     context.Messages.Add(message);
     context.SaveChanges();
 }