public static void GuardarLogInLog(User user) { using (var db = new SisparkModel()) { var sysUserLog = db.UserLog.Create(); sysUserLog.UserId = user.UserId; sysUserLog.FechaYHora = DateTime.Now; sysUserLog.Accion = "Login"; db.UserLog.Add(sysUserLog); db.SaveChanges(); } }
public static void GuardarLogOutLog(string LoggedUser) { using (var db = new SisparkModel()) { var user = db.User.FirstOrDefault(u => u.Usuario == LoggedUser); var sysUserLog = db.UserLog.Create(); sysUserLog.UserId = user.UserId; sysUserLog.FechaYHora = DateTime.Now; sysUserLog.Accion = "Logout"; db.UserLog.Add(sysUserLog); db.SaveChanges(); } }
public static void GuardarSalida(string Logged, Ticket ticket) { using (var db = new SisparkModel()) { var user = db.User.FirstOrDefault(u => u.Usuario == Logged); var TicLog = db.TicketLog.Create(); TicLog.UserId = user.UserId; TicLog.DateTimeLog = DateTime.Now; TicLog.TransactionType = "Salida"; TicLog.TicketId = ticket.TicketId; db.TicketLog.Add(TicLog); db.SaveChanges(); } }