コード例 #1
0
        public JsonResult ListCourse(Course course)
        {
            if (course == null)
            {
                return(Json(new { Message = "Error", HasError = true }));
            }

            var dao  = new CourseDAO();
            var List = dao.ListCourses();

            if (!List.Any())
            {
                return(Json(new { Message = "No entry found", HasError = true, JsonRequestBehavior.AllowGet }));
            }

            return(Json(List, JsonRequestBehavior.AllowGet));
        }