private void AddOrUpdateRate(BookRate rate) { var existing = _rates.SingleOrDefault(x => x.User.Id == rate.User.Id); if (existing != null) { existing.ChangeRate(rate.Rate); } else { _rates.Add(rate); } }
public void SetRate(BookRate bookRate) { AddOrUpdateRate(bookRate); EvaluateRate(); }