/// <summary> /// Load Audit logs of the selected user. /// </summary> public ActionResult Audit() { var userId = Guid.Empty; if (Request.QueryString["userId"] == null || !Guid.TryParse(Request.QueryString["userId"].ToString(), out userId)) { TempData["error"] = "Inavlid url"; return(View(new List <LogEvent>())); } Session["userId"] = userId; var logs = new List <LogModel>(); var eventsQuery = logEventTask.GetLogByUserId(userId); foreach (var eventLog in eventsQuery) { logs.Add(new LogModel() { DisplayDate = eventLog.Date.ToString(), Level = eventLog.Level, Message = eventLog.Message }); } HttpContext.Cache["Logs"] = logs; ViewBag.recordsCount = logs.Count; return(View(logs.Take(Setting.Page_Size).ToList <LogModel>())); }
public IEnumerable <LogEvent> GetLogEventsByUserId(Guid userId) { IEnumerable <LogEvent> events = logEventTask.GetLogByUserId(userId); return(events); }