public eVoucher MapToeVoucher(eVoucherDto item)
        {
            var voucher = new eVoucher
            {
                Id                = item.Id,
                Title             = item.Title,
                Description       = item.Description,
                ExpiryDate        = item.ExpiryDate,
                ImageURL          = item.ImageURL,
                Amount            = item.Amount,
                Quantity          = item.Quantity,
                BuyType           = (BuyType)item.BuyType,
                MaxCanBuyeVoucher = item.MaxCanBuyeVoucher,
                GiftPerUserBuy    = item.GiftPerUserBuy,
                EVoucherStatus    = (eVoucherStatus)item.EVoucherStatus,
                CreatedBy         = item.CreatedBy,
                CreatedDate       = item.CreatedDate,
                UpdatedBy         = item.UpdatedBy,
                UpdatedDate       = item.UpdatedDate
            };

            voucher.eVoucherPaymentMode = new List <eVoucherPaymentMode>();
            voucher.eVoucherPaymentMode = MapToeVoucherPaymentModes(item.eVoucherPaymentModeDtos);
            return(voucher);
        }
        public eVoucherDto MapToeVoucherDto(eVoucher item)
        {
            var eVoucherDto = new eVoucherDto
            {
                Id                = item.Id,
                Title             = item.Title,
                Description       = item.Description,
                ExpiryDate        = item.ExpiryDate,
                ImageURL          = item.ImageURL,
                Amount            = item.Amount,
                Quantity          = item.Quantity,
                BuyType           = (int)item.BuyType,
                MaxCanBuyeVoucher = item.MaxCanBuyeVoucher,
                GiftPerUserBuy    = item.GiftPerUserBuy,
                EVoucherStatus    = (int)item.EVoucherStatus,
                CreatedBy         = item.CreatedBy,
                CreatedDate       = item.CreatedDate,
                UpdatedBy         = item.UpdatedBy,
                UpdatedDate       = item.UpdatedDate
            };

            eVoucherDto.eVoucherPaymentModeDtos = new List <eVoucherPaymentModeDto>();
            eVoucherDto.eVoucherPaymentModeDtos = MapToeVoucherPaymentModeDtos(item.eVoucherPaymentMode);
            return(eVoucherDto);
        }
Exemple #3
0
 public void UpdateVoucher(eVoucher item)
 {
     _context.EVouchers.Update(item);
     _context.EVoucherPaymentModes.UpdateRange(item.eVoucherPaymentMode);
     _context.SaveChanges();
 }
Exemple #4
0
 public void SaveVoucher(eVoucher item)
 {
     _context.EVouchers.Add(item);
     _context.EVoucherPaymentModes.AddRange(item.eVoucherPaymentMode);
     _context.SaveChanges();
 }