BootstrapAdmin/Bootstrap.DataAccess.MongoDB/Message.cs

33 lines
919 B
C#
Raw Normal View History

2018-10-30 13:07:29 +08:00
using MongoDB.Driver;
using System.Collections.Generic;
namespace Bootstrap.DataAccess.MongoDB
{
2018-10-31 17:50:13 +08:00
/// <summary>
///
/// </summary>
2018-10-30 13:07:29 +08:00
public class Message : DataAccess.Message
{
2018-10-31 17:50:13 +08:00
/// <summary>
///
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
protected override IEnumerable<DataAccess.Message> Retrieves(string userName)
2018-10-30 13:07:29 +08:00
{
return DbManager.Messages.Find(message => message.To.ToLowerInvariant() == userName.ToLowerInvariant() || message.From.ToLowerInvariant() == userName.ToLowerInvariant()).ToList();
}
/// <summary>
///
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
public override bool Save(DataAccess.Message msg)
{
DbManager.Messages.InsertOne(msg);
return true;
2018-10-30 13:07:29 +08:00
}
}
}