public virtual Child CreateChild(string name, string userName, string password) { var child = new Child(name, userName, password, this.Id); this.Children.Add(child); return child; }
public virtual void MakePaymentTo(Child child, decimal amount, string description) { if (!this.HasChild(child)) { throw new TardisBankException("{0} is not a child of {1}", child.Name, this.Name); } child.ReceivePayment(amount, description); }
public bool AreNullOrNotRelated(Parent parent, Child child) { if (parent == null || child == null) return true; if (!parent.HasChild(child)) { throw new TardisBankException("'{0}' is not a child of '{1}'", child.UserName, parent.UserName); } return false; }
public virtual void MakePaymentTo(Child child, decimal amount) { this.MakePaymentTo(child, amount, string.Format("Payment from {0}", this.Name)); }
public virtual bool HasChild(Child child) { return this.Children.Any(x => x == child); }
public bool IsNotChildOfCurrentUser(Child child) { var parent = this.CurrentUser as Parent; return (child == null) || (parent == null) || (!parent.HasChild(child)); }