예제 #1
0
        public bool AddOperator(MobileOperator mobileOperator)
        {
            List <MobileOperator> mobileOperators = dataAccess.mobileOperators();

            foreach (MobileOperator operatorr in mobileOperators)
            {
                if (operatorr.OperatorName.ToLower() == mobileOperator.OperatorName.ToLower())
                {
                    throw new InvalidData("Please enter another operator name");
                }
                if (mobileOperator.OperatorRating > 5 || mobileOperator.OperatorRating < 0)
                {
                    throw new RatingOverLoadedException("Please enter rating between 0 and 5");
                }
            }
            DataAcces dataAccess1 = new DataAcces();

            dataAccess1.AddOperator(mobileOperator);
            return(true);
        }