2016-11-05 15:26:42 +08:00
|
|
|
|
using Bootstrap.Admin.Models;
|
|
|
|
|
using Bootstrap.DataAccess;
|
2016-12-06 11:04:49 +08:00
|
|
|
|
using Longbow.Web.Mvc;
|
2016-11-05 15:26:42 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Http;
|
|
|
|
|
|
|
|
|
|
namespace Bootstrap.Admin.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class LogsController : ApiController
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public QueryData<Log> Get([FromUri]QueryLogOption value)
|
|
|
|
|
{
|
|
|
|
|
return value.RetrieveData();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public Log Get(int id)
|
|
|
|
|
{
|
|
|
|
|
return LogHelper.RetrieveLogs().FirstOrDefault(t => t.ID == id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public bool Post([FromBody]Log value)
|
|
|
|
|
{
|
|
|
|
|
var request = HttpContext.Current.Request;
|
|
|
|
|
value.ClientAgent = request.UserAgent;
|
|
|
|
|
value.ClientIp = request.UserHostAddress;
|
|
|
|
|
value.UserName = HttpContext.Current.User.Identity.Name;
|
|
|
|
|
return LogHelper.SaveLog(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-02 15:35:25 +08:00
|
|
|
|
}
|