BootstrapAdmin/Bootstrap.DataAccess/LoginUser.cs

78 lines
1.7 KiB
C#
Raw Normal View History

2019-05-01 16:46:24 +08:00
using Longbow.Web.Mvc;
using PetaPoco;
using System;
namespace Bootstrap.DataAccess
{
/// <summary>
///
/// </summary>
[TableName("LoginLogs")]
public class LoginUser
{
/// <summary>
///
/// </summary>
public string Id { get; set; }
/// <summary>
///
/// </summary>
public string UserName { get; set; }
/// <summary>
///
/// </summary>
public DateTime LoginTime { get; set; }
/// <summary>
///
/// </summary>
public string Ip { get; set; }
/// <summary>
///
/// </summary>
public string Browser { get; set; }
/// <summary>
///
/// </summary>
public string OS { get; set; }
/// <summary>
///
/// </summary>
public string City { get; set; }
/// <summary>
///
/// </summary>
public string Result { get; set; }
2019-05-01 16:46:24 +08:00
/// <summary>
///
/// </summary>
public string UserAgent { get; set; }
/// <summary>
///
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
public virtual bool Log(LoginUser user)
{
var db = DbManager.Create();
db.Save(user);
return true;
}
/// <summary>
///
/// </summary>
/// <param name="po"></param>
/// <returns></returns>
2019-05-01 16:46:24 +08:00
public virtual Page<LoginUser> Retrieves(PaginationOption po) => DbManager.Create().Page<LoginUser>(po.PageIndex, po.Limit, "select UserName, LoginTime, Ip, Browser, OS, City, Result from LoginLogs Order by LoginTime desc");
}
}