public static void Log(string username, string pagina) { try { DatabaseEntities db = new DatabaseEntities(); Usuarios u = db.Usuarios.Where(i => i.Nombre == username).Single(); LogVisita lv = new LogVisita() { Usuario = u, Pagina = pagina, Hora = DateTime.Now }; db.LogVisitas.AddObject(lv); db.SaveChanges(); } catch { } }
/// <summary> /// Create a new LogVisita object. /// </summary> /// <param name="usuarioID">Initial value of the UsuarioID property.</param> /// <param name="hora">Initial value of the Hora property.</param> /// <param name="pagina">Initial value of the Pagina property.</param> public static LogVisita CreateLogVisita(global::System.Int32 usuarioID, global::System.DateTime hora, global::System.String pagina) { LogVisita logVisita = new LogVisita(); logVisita.UsuarioID = usuarioID; logVisita.Hora = hora; logVisita.Pagina = pagina; return logVisita; }
/// <summary> /// Deprecated Method for adding a new object to the LogVisitas EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToLogVisitas(LogVisita logVisita) { base.AddObject("LogVisitas", logVisita); }