public override void Update(Title entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } entity.AvailableStock = entity.TotalStock - _rentalHistoryRepository.FindBy(x => x.TitleId == entity.Id && !x.Returned).Count(); _titleRepository.Edit(entity); _unitOfWork.Commit(); }
public IEnumerable <RentalHistory> GetByUserId(string id) { return(_rentalHistoryRepository.FindBy(x => x.UserId == id)); }