示例#1
0
        public List <AdvancedCourseModel> MostProfitableCourses()
        {
            List <AdvancedCourseModel> mostProfCourses = new List <AdvancedCourseModel>();

            CourseDAO     course      = new CourseDAO();
            List <Course> coursesProf = course.MostProfitable();

            foreach (Course courseP in coursesProf)
            {
                AdvancedCourseModel newCourse = new AdvancedCourseModel();
                newCourse.Id      = courseP.Id;
                newCourse.Name    = courseP.Name;
                newCourse.Cost    = courseP.CourseCost;
                newCourse.SumCost = course.GetCountToId(newCourse.Id) * newCourse.Cost;
                mostProfCourses.Add(newCourse);
            }

            return(mostProfCourses);
        }