public void AddAccountTest(Guid id) { AccountDto accountDto = new AccountDto(); accountDto.Code = "2/0/0"; accountDto.Balance = 10000; accountDto.Description = "bank melli 213"; accountDto.IndexAccountId = id; accountDto.IndexAccountCode = "2/0"; accountDto.RowId = 0; accountDto.No = "120000"; PersonAccountService pa = new PersonAccountService(); string str = pa.AddAccount(accountDto); }
public string AddAccount(AccountDto accountDto) { try { AccountRepository repository = new AccountRepository(); IndexAccount indexAccount = repository.ActiveContext.IndexAccounts.Include("BankAccounts") .FirstOrDefault(ia => ia.Id == accountDto.IndexAccountId); if (!indexAccount.ContainAccount(accountDto.Code)) { Account account = new Account(); accountDto.Id = Guid.NewGuid(); account.InjectFrom <UnflatLoopValueInjection>(accountDto); account.IndexAccount = indexAccount; repository.Add(account); return("account is created"); } return("account with this code is recreated !?"); } catch (Exception exception) { return(exception.Message); } }
public string AddAccount(AccountDto accountDto) { try { AccountRepository repository = new AccountRepository(); IndexAccount indexAccount = repository.ActiveContext.IndexAccounts.Include("BankAccounts") .FirstOrDefault(ia => ia.Id == accountDto.IndexAccountId); if (!indexAccount.ContainAccount(accountDto.Code)) { Account account = new Account(); accountDto.Id = Guid.NewGuid(); account.InjectFrom<UnflatLoopValueInjection>(accountDto); account.IndexAccount = indexAccount; repository.Add(account); return "account is created"; } return "account with this code is recreated !?"; } catch (Exception exception) { return exception.Message; } }