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