private BankModel Create(BankModel item) { var data = item.ConvertToData(); using (_unitOfWorkFactory.Create()) { _repository.Add(data); } return(data.ConvertToModel()); }
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); } } }
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)); }
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)); }
public Bank Create(Bank objectToCreate) { repository.Add(objectToCreate); Save(); return(objectToCreate); }
public async Task <bool> RegisterBank(Bank bank) { return(await _bankRepository.Add(bank)); }
public IActionResult AddBank([FromBody] Bank model) { Bank_repo.Add(model); return(new OkObjectResult(new { BankID = model.BankId })); }
public void CreateBank(BankMaster Bank) { _bankRepository.Add(Bank); _unitOfWork.Commit(); }