コード例 #1
0
        // GET: Classe
        public async Task <IActionResult> Index()
        {
            var model = new List <ClassIndexModel>();

            var classes = await cls.GetAllAsync();

            foreach (var item in classes)
            {
                var o = new ClassIndexModel()
                {
                    Id         = item.Id,
                    classeName = item.Name,
                    depName    = item.department.Name
                };
                o.TotalCourses = crs.CourseByClassId(item.Id).Count();
                model.Add(o);
            }

            return(View(model));
        }