protected override async Task OnInitializedAsync() { try { IsDataLoaded = false; ErrorMessage = string.Empty; UserName = await _sessionStorageService.GetItemAsync <string>("UserName"); CompanyId = await _sessionStorageService.GetItemAsync <string>("CompanyId"); var param = new Dapper.DynamicParameters(); param.Add("accountId", Guid.Parse(accountId), System.Data.DbType.Guid); JournalEntries = await dapperManager.GetAllAsync <JournalDetailViewModel>("spGetGLTransactions", param); var glAccount = await appDBContext.GLAccounts.Where(a => a.accountId.Equals(Guid.Parse(accountId))).FirstOrDefaultAsync(); if (glAccount != null) { HeaderTitle = $"{glAccount.accountCode} - {glAccount.accountDesc}"; } totalDR = JournalEntries.Sum(a => a.drAmt); totalCR = JournalEntries.Sum(a => a.crAmt); if (totalDR.HasValue || totalCR.HasValue) { totalBalance = (totalDR.HasValue ? totalDR.Value : 0) - (totalCR.HasValue ? totalCR.Value : 0); } } catch (Exception ex) { ErrorMessage = ex.Message; } finally { IsDataLoaded = true; } }