Esempio n. 1
0
        public async Task DeleteBillAsync(Guid id)
        {
            Bill bill = await _billRepository.FirstOrDefaultAsync(id);

            if (bill == null)
            {
                throw new InvalidOperationException("该类型不存在");
            }
            _unitOfWork.RegisterDelete(bill);
            await _unitOfWork.CommitAsync();
        }
Esempio n. 2
0
        public async Task DeleteUserAsync(Guid id)
        {
            User userFromDB = await _userRepository.FirstOrDefaultAsync(id);

            if (userFromDB == null)
            {
                throw new InvalidOperationException("用户不存在");
            }
            _unitOfWork.RegisterDelete(userFromDB);
            await _unitOfWork.CommitAsync();
        }