示例#1
0
        public void AddBike(string name, decimal hourCost)
        {
            if (!_bikeNameVerifier.IsFree(name))
            {
                throw new InvalidOperationException("Bike with same name already exists");
            }

            Bike newBike = new Bike(name, hourCost);

            _repository.Add(newBike);
        }
        public void Add(string surname, string firstname, string patronymic)
        {
            Employee employee = new Employee(surname, firstname, patronymic);

            if (!_nameVerifier.IsFree(employee.GetUniqueName()))
            {
                throw new InvalidOperationException("Employee with same name already exists");
            }

            _repository.Add(employee);
        }
        public void AddRentPoint(Employee employee, decimal money, string name)
        {
            if (employee == null)
            {
                throw new ArgumentNullException(nameof(employee));
            }

            if (money < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(money));
            }

            if (_nameVerifier.IsFree(name))
            {
                throw new InvalidOperationException("RentPoint with same name already exists");
            }

            _repository.Add(new RentPoint(employee, money, name));
        }