using Longbow.Cache;
using Longbow.Data;
using System.Collections.Generic;
using System.Linq;
namespace Bootstrap.DataAccess
{
///
///
///
public static class MessageHelper
{
///
///
///
public const string RetrieveMessageDataKey = "MessageHelper-RetrieveMessages";
///
/// 收件箱
///
///
public static IEnumerable Inbox(string userName) => DbContextManager.Create().Inbox(userName);
///
/// 发件箱
///
///
///
public static IEnumerable SendMail(string userName) => DbContextManager.Create().SendMail(userName);
///
/// 垃圾箱
///
///
///
public static IEnumerable Trash(string userName) => DbContextManager.Create().Trash(userName);
///
/// 标旗
///
///
///
public static IEnumerable Mark(string userName) => DbContextManager.Create().Mark(userName);
///
/// 获取Header处显示的消息列表
///
///
///
public static IEnumerable Retrieves(string userName) => CacheManager.GetOrAdd(RetrieveMessageDataKey, key => DbContextManager.Create().RetrieveHeaders(userName).OrderByDescending(n => n.SendTime));
public static bool Save(Message msg) => DbContextManager.Create().Save(msg);
}
}