using Bootstrap.Admin.Query; using Bootstrap.DataAccess; using Longbow.Web.Mvc; using Microsoft.AspNetCore.Mvc; using System.Linq; namespace Bootstrap.Admin.Controllers.Api { /// /// /// [Route("api/[controller]")] public class LogsController : Controller { /// /// /// /// /// [HttpGet] public QueryData Get(QueryLogOption value) { return value.RetrieveData(); } /// /// /// /// /// [HttpGet("{id}")] public Log Get(int id) { return LogHelper.RetrieveLogs().FirstOrDefault(t => t.Id == id); } [HttpPost] public bool Post([FromBody]Log value) { value.ClientAgent = Request.Headers["User-Agent"]; value.ClientIp = HttpContext.Connection.RemoteIpAddress.ToString(); value.UserName = User.Identity.Name; return LogHelper.SaveLog(value); } } }