コード例 #1
0
        public async Task <IActionResult> View(ViewAddressModel model)
        {
            var appid = _tokenManager.ValidateAccessToken(model.AccessToken);
            var logs  = (await _dbContext
                         .ErrorLogs
                         .Where(t => t.AppId == appid)
                         .ToListAsync())
                        .GroupBy(t => t.Message)
                        .Select(t => new LogCollection
            {
                Message = t.Key,
                First   = t.OrderByDescending(p => p.LogTime).FirstOrDefault(),
                Count   = t.Count()
            })
                        .ToList();
            var viewModel = new ViewLogViewModel
            {
                AppId   = appid,
                Logs    = logs,
                Code    = ErrorType.Success,
                Message = "Successfully get your logs!"
            };

            return(this.Protocol(viewModel));
        }
コード例 #2
0
        public async Task <IActionResult> View(ViewAddressModel model)
        {
            var appid    = _tokenManager.ValidateAccessToken(model.AccessToken);
            var appLocal = await _dbContext.StatusApps.SingleOrDefaultAsync(t => t.AppId == appid);

            if (appLocal == null)
            {
                appLocal = new StatusApp
                {
                    AppId = appid
                };
                _dbContext.StatusApps.Add(appLocal);
                await _dbContext.SaveChangesAsync();
            }

            var logs = await _dbContext
                       .ErrorLogs
                       .Where(t => t.AppId == appid)
                       .ToListAsync();

            var viewModel = new ViewLogViewModel
            {
                AppId   = appLocal.AppId,
                Logs    = logs,
                Code    = ErrorType.Success,
                Message = "Successfully get your logs!"
            };

            return(Json(viewModel));
        }
コード例 #3
0
ファイル: EventController.cs プロジェクト: supeng222/Nexus
        public async Task <IActionResult> View(ViewAddressModel model)
        {
            var appid = await _tokenManager.ValidateAccessToken(model.AccessToken);

            var appLocal = await _dbContext.StatusApps.SingleOrDefaultAsync(t => t.AppId == appid);

            if (appLocal == null)
            {
                appLocal = new StatusApp
                {
                    AppId = appid
                };
                _dbContext.StatusApps.Add(appLocal);
                await _dbContext.SaveChangesAsync();
            }

            var logs = (await _dbContext
                        .ErrorLogs
                        .Where(t => t.AppId == appid)
                        .ToListAsync())
                       .GroupBy(t => t.Message)
                       .Select(t => new LogCollection
            {
                Message = t.Key,
                First   = t.OrderByDescending(p => p.LogTime).FirstOrDefault(),
                Count   = t.Count()
            })
                       .ToList();
            var viewModel = new ViewLogViewModel
            {
                AppId   = appLocal.AppId,
                Logs    = logs,
                Code    = ErrorType.Success,
                Message = "Successfully get your logs!"
            };

            return(Json(viewModel));
        }
コード例 #4
0
 public ViewLogControl(ViewLogViewModel viewModel)
 {
     InitializeComponent();
     DataContext = viewModel;
 }