示例#1
0
文件: Book.cs 项目: mtarcha/Library
        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);
            }
        }
示例#2
0
文件: Book.cs 项目: mtarcha/Library
 public void SetRate(BookRate bookRate)
 {
     AddOrUpdateRate(bookRate);
     EvaluateRate();
 }