public virtual void AdminChangePrice(decimal newPrice) { if (newPrice < 0) { throw new ArgumentOutOfRangeException(nameof(newPrice)); } Price = new TutorPrice(newPrice); AddEvent(new UpdateTutorSettingsEvent(Id)); }
public virtual void UpdateSettings(string bio, decimal?price) { if (price.HasValue) { if (price < MinimumPrice || price > MaximumPrice) { throw new ArgumentOutOfRangeException(nameof(price)); } Price = new TutorPrice(price.Value); } Bio = bio; // SubsidizedPrice = PriceAfterDiscount(price); AddEvent(new UpdateTutorSettingsEvent(Id)); }
public Tutor(string bio, User user, decimal?price) : this() { User = user ?? throw new ArgumentNullException(nameof(user)); State = ItemState.Pending; Created = DateTime.UtcNow; Bio = bio; Country country = user.Country; if (country == Country.India) { Price = new TutorPrice(100, 0); } else { if (price is null) { throw new ArgumentException("Price is null"); } Price = new TutorPrice(price.Value); } //SubsidizedPrice = subsidizedPrice; }