_investmentRepository.Table.Where(t => t.CustomerId == customerId && t.InvestmentStatus == tempStatus).Sum(t =>t.Amount);
查詢結果存在NULL值,在嘗試將它轉換成System.Int32時出了錯,解決方法如下
_investmentRepository.Table.Where(t => t.CustomerId == customerId && t.InvestmentStatus == tempStatus).Sum(t => (decimal?)t.Amount) ?? 0;
