示例#1
0
        private BankModel Create(BankModel item)
        {
            var data = item.ConvertToData();

            using (_unitOfWorkFactory.Create())
            {
                _repository.Add(data);
            }


            return(data.ConvertToModel());
        }
示例#2
0
        public async Task IncludeSequenceToDataBaseAsync(IEnumerable <Bank> banks)
        {
            foreach (var bank in banks)
            {
                var oldBank = await _bankRepository.FindByNameAsync(bank.Name);

                if (oldBank == null)
                {
                    _bankRepository.Add(bank);
                }
                else
                {
                    oldBank.BankDepartment.IncludeSequence(bank.BankDepartment);
                }
            }
        }
示例#3
0
        public IActionResult CreateBank(AddBankModel model)
        {
            if (ModelState.IsValid)
            {
                AddBankModel bank = new AddBankModel();

                _bankRepository.Add(new Bank
                {
                    Id       = model.Id,
                    BankName = model.BankName,
                    CardNo   = model.CardNo,
                    Iban     = model.Iban,
                    Password = model.Password,
                    SKT      = model.SKT,
                    CVVB     = model.CVVB,
                    CVVK     = model.CVVK,
                });

                return(RedirectToAction("index", "bank"));
            }
            return(View(model));
        }
示例#4
0
        public BankViewModel AddBank(BankViewModel model)
        {
            var bankCodeSpec = new BankByBankCodeSpec(model.BankCode);
            var existedBank  = bankRepository.FindOne(bankCodeSpec);

            if (existedBank != null)
            {
                throw new ValidationException($"Bank with code {model.BankCode} already exist. Enter another one.");
            }
            var bank = Bank.Create(model.Name, model.IsGroup, model.ParentId, model.BankCode, model.CorrAccount, model.Address, model.Phones, model.City);

            try
            {
                unitOfWork.BeginTransaction();
                bankRepository.Add(bank);
                unitOfWork.Commit();
            }
            catch (System.Exception)
            {
                unitOfWork.Rollback();
                throw;
            }
            return(BankViewModel.MapFromData(bank));
        }
示例#5
0
 public Bank Create(Bank objectToCreate)
 {
     repository.Add(objectToCreate);
     Save();
     return(objectToCreate);
 }
示例#6
0
 public async Task <bool> RegisterBank(Bank bank)
 {
     return(await _bankRepository.Add(bank));
 }
示例#7
0
 public IActionResult AddBank([FromBody] Bank model)
 {
     Bank_repo.Add(model);
     return(new OkObjectResult(new { BankID = model.BankId }));
 }
示例#8
0
 public void CreateBank(BankMaster Bank)
 {
     _bankRepository.Add(Bank);
     _unitOfWork.Commit();
 }