/// <summary> /// Deprecated Method for adding a new object to the ContentActionEvents EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToContentActionEvents(ContentActionEvent contentActionEvent) { base.AddObject("ContentActionEvents", contentActionEvent); }
// ************************************** // LogUserEvent: ContentActionEvent // ************************************** public static void LogContentEvent(ContentActions action, int contentId) { if (SystemConfig.LogUserContentActions) { var actionEvent = new ContentActionEvent() { ContentActionId = (int)action, ContentId = contentId, UserId = Account.User().UserId, ContentActionEventDate = DateTime.Now, SessionId = CurrentSessionId() }; LogActionEventDelegate<ContentActionEvent> logActionEventDelegate = new LogActionEventDelegate<ContentActionEvent>(LogEvent); logActionEventDelegate.BeginInvoke(actionEvent, null, null); } }
/// <summary> /// Create a new ContentActionEvent object. /// </summary> /// <param name="contentActionEventId">Initial value of the ContentActionEventId property.</param> /// <param name="contentActionEventDate">Initial value of the ContentActionEventDate property.</param> /// <param name="sessionId">Initial value of the SessionId property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="contentActionId">Initial value of the ContentActionId property.</param> /// <param name="contentId">Initial value of the ContentId property.</param> public static ContentActionEvent CreateContentActionEvent(global::System.Int64 contentActionEventId, global::System.DateTime contentActionEventDate, global::System.String sessionId, global::System.Int32 userId, global::System.Int32 contentActionId, global::System.Int32 contentId) { ContentActionEvent contentActionEvent = new ContentActionEvent(); contentActionEvent.ContentActionEventId = contentActionEventId; contentActionEvent.ContentActionEventDate = contentActionEventDate; contentActionEvent.SessionId = sessionId; contentActionEvent.UserId = userId; contentActionEvent.ContentActionId = contentActionId; contentActionEvent.ContentId = contentId; return contentActionEvent; }
// ************************************** //LogUserActionEvent // ************************************** private static void LogEvent(ContentActionEvent logEvent) { using (var ctx = new SongSearchContext()) { ctx.ContextOptions.LazyLoadingEnabled = false; try { ctx.ContentActionEvents.AddObject(logEvent); ctx.SaveChanges(); } catch (Exception ex) { Log.Error(ex); } } }