public void LogPageView(string area, string controller, string action, string referredUrl, string ipAddress, string userAgent, int?userId) { var newAnalyticPageView = new AnalyticPageView { Area = area ?? "", Controller = controller, Action = action, ReferredUrl = referredUrl, IPAddress = ipAddress, UserAgent = userAgent, UserId = userId ?? 0, DateAdded = DateTime.Now }; _context.AnalyticPageViews.Add(newAnalyticPageView); _context.SaveChanges(); }
public async Task LogPageViewAsync(string area, string controller, string action, string referredUrl, string ipAddress, string userAgent, string userId) { var newAnalyticPageView = new AnalyticPageView { Area = area ?? "", Controller = controller, Action = action, ReferredUrl = referredUrl, IPAddress = ipAddress, UserAgent = userAgent, UserId = userId ?? string.Empty, DateAdded = DateTime.Now }; _context.AnalyticPageViews.Add(newAnalyticPageView); await _context.SaveChangesAsync(); }