/// <summary> /// Get Total Returned Quantity by Asset Id /// and returned Quantity by Asset Purchase Id /// </summary> /// <param name="assetId"></param> /// <returns></returns> private int GetTotalReturnedQuantity(long assetId, long currentAnnualBudgetId) { int sum = 0; var purchaseReturnList = _repAsset.GetPurchaseReturn() .Where(x => x.AssetId == assetId) .Where(x => x.CurrentAnnualBudgetId == currentAnnualBudgetId) .ToList(); for (int i = 0; i < purchaseReturnList.Count; i++) { sum += purchaseReturnList[i].Quantity; } return(sum); }