public bool Equals(Worker value) { if (ReferenceEquals(null, value)) { return false; } if (ReferenceEquals(this, value)) { return true; } return Equals(this.name, value.name) && this.salary == value.salary; }
/// <summary> /// Removes the worker. /// </summary> /// <param name="hiredWorker">The hired worker.</param> public void RemoveWorker(Worker hiredWorker) { if (this.workerList.Contains(hiredWorker)) { this.workerList.Remove(hiredWorker); } else { throw new PopayeShopException("Wrong data entered...This worker doesnt exist"); } }
/// <summary> /// Adds the worker. /// </summary> /// <param name="hiredWorker">The hired worker.</param> public void AddWorker(Worker hiredWorker) { if (this.workerList.Contains(hiredWorker)) { throw new PopayeShopException("We cannot hire the same person twice"); } this.workerList.Add(hiredWorker); }