public ActionResult AuditLogList2(DateTime?startTime, DateTime?endTime, string keyword, int draw, int start, int length, Dictionary <string, string>[] order) { FluentModel db = Session.GetFluentModel(); SuncereAuditLogRepository repository = new SuncereAuditLogRepository(db); IQueryable <SuncereAuditLog> query = repository.Query(startTime, endTime, keyword); List <SuncereAuditLog> list = query.Skip(start).Take(length).ToList(); return(Json(new { draw = draw, recordsTotal = query.Count(), recordsFiltered = query.Count(), data = list.Select(o => new string[] { o.UserName, o.Url, o.Referrer, o.HostName, o.HostAddress, o.CreationTime.ToString("yyyy-MM-dd HH:mm") }) }, JsonRequestBehavior.AllowGet)); }
public ActionResult AuditLogList(DateTime?startTime, DateTime?endTime, string keyword) { FluentModel db = Session.GetFluentModel(); SuncereAuditLogRepository repository = new SuncereAuditLogRepository(db); List <SuncereAuditLog> list = repository.Query(startTime, endTime, keyword).ToList(); ViewData["startTime"] = startTime; ViewData["endTime"] = endTime; ViewData["keyword"] = keyword; return(View(list)); }
public ActionResult AuditLogDelete(string ids) { AjaxResult result; try { int[] idArray = ids.Split(',').Select(o => int.Parse(o)).ToArray(); FluentModel db = Session.GetFluentModel(); SuncereAuditLogRepository repository = new SuncereAuditLogRepository(db); IQueryable <SuncereAuditLog> query = repository.Query(idArray); db.Delete(query); db.SaveChanges(); result = AjaxResult.GetDeleteAjaxResult(true); } catch (Exception e) { result = AjaxResult.GetDeleteAjaxResult(false); } return(Json(result, JsonRequestBehavior.DenyGet)); }