public async Task <IActionResult> List() { try { List <FundTransactionHistoryModel> model = new List <FundTransactionHistoryModel>(); model = (await _fundTransactionHistoryService.GetListBalanceFund(Common.EditStatus.Updating)).Where(i => i.TotalInvestNoOfCertificates != i.TotalWithdrawnNoOfCertificates).OrderBy(i => i.Fund.Code).ToList(); return(View(model)); } catch (System.Exception ex) { throw ex; } }
public async Task BatchUpdateDealFund() { try { await _globalConfigurationService.SetValueConfig(Constants.Configuration.ProgramLocked, "true"); var fundList = (await _fundTransactionHistoryService.GetListBalanceFund(EditStatus.Updating)); var funds = fundList.Where(h => Math.Abs((h.TotalInvestNoOfCertificates - h.TotalWithdrawnNoOfCertificates) * h.Fund.NAV) > 3000000).ToList(); foreach (var fund in funds) { var transactionAmount = (fund.TotalInvestNoOfCertificates - fund.TotalWithdrawnNoOfCertificates) * fund.Fund.NAV; await updateDealFun(fund.Fund.Id, transactionAmount); } } finally { await _globalConfigurationService.SetValueConfig(Constants.Configuration.ProgramLocked, "false"); } }