private static ThreadStart CriarStartThreadDoLog(NancyContext ctx) { return(() => { var jwtToken = ctx.Request.Headers.Authorization; var usuario = JsonWebToken.DecodeToObject(jwtToken, "", false) as IDictionary <string, object>; var url = ctx.Request.Path; var method = ctx.Request.Method; var iP = ctx.Request.UserHostAddress; var acao = PegarAcaoPeloMethodEUrl(method, url); var logPortal = new LogAcoesPortal { ID_Usuario = (int)usuario["id"], Url = url, Acao = acao, IP = iP, Datacesso = DateTime.Now }; try { new BMLogAcoesPortal().Salvar(logPortal); } catch { } }); }
public void Salvar(LogAcoesPortal logAcoesPortal) { session.Persist(logAcoesPortal); }