private void AddCoupons(string eventId, IEnumerable<CouponTypeDto> couponTypes, IEnumerable<SupportTypeDto> supportTypes, IMyMentorRepository repository, EntityDto[] entities, IEnumerable<CouponStatusDto> couponStatuses, List<AccountStatementViewModel> accountStatementVm, string nisCurrencySymbol) { IEnumerable<Coupon> coupons = Task.Run(() => repository.FindCouponsInEvent(eventId)).Result; foreach (var coupon in coupons) { var asvm = new AccountStatementViewModel(); asvm.Id = coupon.ObjectId; asvm.Type = entities.FindEntityName(EntityKeys.Coupons); asvm.UserName = coupon.IssuedBy.GetFullName(Language.CurrentLanguageCode); asvm.DueDate = coupon.CreatedAt.HasValue ? coupon.CreatedAt.Value : DateTime.MinValue; asvm.TransActionDate = coupon.CreatedAt.HasValue ? coupon.CreatedAt.Value : DateTime.MinValue; asvm.Item = coupon.GetItemName(entities); asvm.Status = couponStatuses.First(x => x.CouponStatusCode.ToLower() == coupon.CouponStatus.ToLower()).GetLocalizedField("CouponStatus"); asvm.Amount = coupon.GetFormattedAmount(); asvm.AmountNis = coupon.GetFormattedAmountNis(); asvm.Balance = coupon.GetFormattedBalance(); asvm.BalanceNis = coupon.GetFormattedBalanceNis(); asvm.Remarks = coupon.CouponType; asvm.AmountClassName = "azure"; asvm.CreatedAt = coupon.CreatedAt.Value; asvm.Coupon = GetCouponView(coupon, couponTypes, supportTypes, couponStatuses, nisCurrencySymbol); accountStatementVm.Add(asvm); } }