Ejemplo n.º 1
0
        private async Task SeedPaymentMethodsAsync()
        {
            if (await _paymentMethodRepository.HasItemsAsync())
            {
                return;
            }

            try
            {
                await _paymentMethodRepository.AddAsync(new PaymentMethod
                {
                    // Id = 1,
                    Name   = "Bank Transfer",
                    Status = Constants.RecordStatus.Active
                });

                await _paymentMethodRepository.AddAsync(new PaymentMethod
                {
                    //   Id = 2,
                    Name   = "Cash",
                    Status = Constants.RecordStatus.Active
                });

                await _paymentMethodRepository.AddAsync(new PaymentMethod
                {
                    // Id = 3,
                    Name   = "Cheque",
                    Status = Constants.RecordStatus.Active
                });

                await _unitOfWork.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error in payment methods seeding {ex}");
            }
        }