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]")] [ApiController] public class LogsController : ControllerBase { /// /// /// /// /// [HttpGet] public QueryData Get([FromQuery]QueryLogOption value) { return value.RetrieveData(); } /// /// /// /// /// [HttpGet("{id}")] public Log Get(string id) { return LogHelper.Retrieves().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.Save(value); } } }