public bool DeleteAccount(Account account) { if (account == null) return false; _unitOfWork.AccountRepository.Delete(account); _unitOfWork.Save(); return true; }
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; }
public bool EditAccount(Account entity) { _unitOfWork.AccountRepository.Edit(entity); _unitOfWork.Save(); return true; }
public bool AddAccount(Account entity) { _unitOfWork.AccountRepository.Add(entity); _unitOfWork.Save(); return true; }