예제 #1
0
 public bool DeleteAccount(Account account)
 {
     if (account == null) return false;
     _unitOfWork.AccountRepository.Delete(account);
     _unitOfWork.Save();
     return true;
 }
예제 #2
0
        public int GetAccountIdWithCreate(string entityType, int entityId)
        {
            var account = _unitOfWork.AccountRepository.FindBy(t => t.EntityType == entityType && t.EntityID == entityId);

            if (account.Count == 0)
            {
                // this means it doesn't exist, insert it here.

                var  newAccount = new Account();
                newAccount.EntityID = entityId;
                newAccount.EntityType = entityType;
                _unitOfWork.AccountRepository.Add(newAccount);
                _unitOfWork.Save();
                return newAccount.AccountID;
            }

            return  account.FirstOrDefault().AccountID;
        }
예제 #3
0
 public bool EditAccount(Account entity)
 {
     _unitOfWork.AccountRepository.Edit(entity);
     _unitOfWork.Save();
     return true;
 }
예제 #4
0
 public bool AddAccount(Account entity)
 {
     _unitOfWork.AccountRepository.Add(entity);
     _unitOfWork.Save();
     return true;
 }