コード例 #1
0
        public void Add(TransactionsDto dto)
        {
            var domain = new Transactions();

            DomainServicesMapper.MapToTransactions(dto, domain);
            repository.Add(domain);
            Logger.AddLOGMsg($"Add Transaction with Amount -> {dto.Amount} Sku -> {dto.Sku} Currency -> {dto.Currency}");
        }
コード例 #2
0
        public void Update(TransactionsDto dto)
        {
            var domain = repository.GetByPKs(dto.Sku, dto.Currency);

            DomainServicesMapper.MapToTransactions(dto, domain);
            repository.Update(domain);
            Logger.AddLOGMsg($"Updated Transaction with Amount -> {dto.Amount} Sku -> {dto.Sku} Currency -> {dto.Currency}");
        }
コード例 #3
0
        private void RefreshTransactionsFromTheResource(IEnumerable <TransactionsDto> dtos)
        {
            Logger.AddLOGMsg("Deleted All Transactions");
            using (var context = GetNewContext())
            {
                _sqlBulkLogic.BulkDelete(TableName);

                var domains = new List <Transactions>();
                foreach (var dto in dtos)
                {
                    var domain = new Transactions();
                    DomainServicesMapper.MapToTransactions(dto, domain);
                    domains.Add(domain);
                }

                _sqlBulkLogic.BulkInsert(domains, TableName);
            }
            Logger.AddLOGMsg("Saved New Transactions");
        }