using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Bootstrap.DataAccess.MongoDB
{
///
///
///
public class ResetUser : DataAccess.ResetUser
{
///
///
///
///
///
public override DataAccess.ResetUser RetrieveUserByUserName(string userName) => DbManager.ResetUsers.Find(user => user.UserName.ToLowerInvariant() == userName.ToLowerInvariant()).FirstOrDefault();
///
///
///
///
///
public override IEnumerable> RetrieveResetReasonsByUserName(string userName) => DbManager.ResetUsers.Find(user => user.UserName.ToLowerInvariant() == userName.ToLowerInvariant()).ToList().OrderByDescending(user => user.ResetTime).Select(user => new KeyValuePair(user.ResetTime, user.Reason));
///
///
///
///
public override void DeleteByUserName(string userName) => DbManager.ResetUsers.DeleteMany(User => User.UserName.ToLowerInvariant() == userName.ToLowerInvariant());
}
}