public async Task <IEnumerable <ChangeLogModel> > GetChangeLogAsync(ChangeLogAdminSearchModel model)
 {
     return(await Context.ChangeLog
            .OrderByDescending(x => x.Id)
            .Select(x => new ChangeLogModel
     {
         DatabaseName = x.DatabaseName,
         EventDate = x.EventDate,
         EventType = x.EventType,
         LoginName = x.LoginName,
         ObjectName = x.ObjectName,
         ObjectType = x.ObjectType,
         SqlCommand = x.SqlCommand
     }).ToListAsync());
 }
Esempio n. 2
0
        public async Task <ChangeLogListModel> MakeListModel(ChangeLogAdminSearchModel searchModel)
        {
            var changeLogs = await _changeLogAdminHandler.SearchChangeLog(searchModel);

            var changeLogItems = changeLogs.Select(x => new ChangeLogListItemModel
            {
                EventDate    = x.EventDate,
                DatabaseName = x.DatabaseName,
                EventType    = x.EventType,
                LoginName    = x.LoginName,
                ObjectName   = x.ObjectName,
                ObjectType   = x.ObjectType,
                SqlCommand   = x.SqlCommand
            });
            var changeLogItemsPagedList = new PagedList <ChangeLogListItemModel>(
                changeLogItems,
                changeLogs.PageIndex,
                changeLogs.PageSize,
                changeLogs.TotalCount
                );

            return(new ChangeLogListModel().PrepareToGrid(searchModel, changeLogs, () => changeLogItemsPagedList));
        }
Esempio n. 3
0
 public async Task <IEnumerable <ChangeLogModel> > FetchChangeLogAsync(ChangeLogAdminSearchModel model)
 {
     return(await _unitOfWorkManager.ExecuteSingleAsync <IChangeLogRepository, IEnumerable <ChangeLogModel> >
                (u => u.GetChangeLogAsync(model)));
 }
Esempio n. 4
0
        public async Task <JsonResult> SearchChangeLogs(ChangeLogAdminSearchModel searchModel)
        {
            var model = await _changeLogFactory.MakeListModel(searchModel);

            return(Json(model));
        }