コード例 #1
0
        public AccountDbRepoModel GetAccountById(int id)
        {
            var accountEnity = new AccountDbRepoModel();

            using (_unitOfWork.Add <AccountDbRepoModel>())
            {
                accountEnity = _unitOfWork.GetRepository <AccountDbRepoModel>().Get(acc => acc.Id == id, null, "Status,CurrencyRelation").FirstOrDefault();
            }

            return(accountEnity);
        }
コード例 #2
0
        public int CreateAccount(AccountModel account)
        {
            var accountEntity = new AccountDbRepoModel();

            using (_unitOfWork.Add <AccountDbRepoModel>())
            {
                accountEntity = _mapper.Map <AccountDbRepoModel>(account);

                _unitOfWork.GetRepository <AccountDbRepoModel>().AddItem(accountEntity);
                _unitOfWork.Save();
            }

            return(accountEntity.Id);
        }