示例#1
0
        public List <MobileOperatorModel> displaymobileoperatorss()
        {
            List <Operator>            avg = business.Average();
            List <MobileOperatorModel> mobileOperatorModels = new List <MobileOperatorModel>();
            List <Operator>            mobiles      = business.mobileOperators();
            List <Operator>            mobileAbvAvg = new List <Operator>();

            foreach (var mobileOperator in mobiles)
            {
                foreach (var item in avg)
                {
                    if (mobileOperator.OperatorRating > item.OperatorRating)
                    {
                        mobileAbvAvg.Add(mobileOperator);
                    }
                }
            }
            foreach (var ms in mobileAbvAvg)
            {
                MobileOperatorModel mobileOperatorModel = new MobileOperatorModel();
                mobileOperatorModel.OperatorId     = ms.OperatorId;
                mobileOperatorModel.OperatorName   = ms.OperatorName;
                mobileOperatorModel.OperatorRating = ms.OperatorRating;
                mobileOperatorModels.Add(mobileOperatorModel);
            }
            return(mobileOperatorModels);
        }
        public void AddOperator(MobileOperatorModel mobileOperatorModel)
        {
            MobileOperator mobileOperator = new MobileOperator();

            mobileOperator.OperatorName   = mobileOperatorModel.OperatorName;
            mobileOperator.OperatorRating = mobileOperatorModel.OperatorRating;
            Busines busines = new Busines();

            busines.AddOperator(mobileOperator);
        }
        public List <MobileOperatorModel> mobileOperators()
        {
            List <MobileOperatorModel> mobileOperatorModels = new List <MobileOperatorModel>();
            List <MobileOperator>      mobileOperators      = business.mobileOperators();

            foreach (var mobileOperator in mobileOperators)
            {
                MobileOperatorModel mobileOperatorModel = new MobileOperatorModel();
                mobileOperatorModel.OperatorId     = mobileOperator.OperatorId;
                mobileOperatorModel.OperatorName   = mobileOperator.OperatorName;
                mobileOperatorModel.OperatorRating = mobileOperator.OperatorRating;
                mobileOperatorModels.Add(mobileOperatorModel);
            }
            return(mobileOperatorModels);
        }