コード例 #1
0
        public IActionResult ShowCours(int id)
        {
            var course = _courseServices.GetCourseById(id);

            if (course == null)
            {
                return(NotFound());
            }
            return(View(course));
        }
コード例 #2
0
        public IActionResult Get(int id)
        {
            var Course = _courseServices.GetCourseById(id);

            if (Course == null)
            {
                return(NotFound());
            }
            return(Ok(Course));
        }
コード例 #3
0
 public ActionResult <IEnumerable <Course> > GetCourseById([FromRoute] int id)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     else
     {
         var courseobj = _COURSEDAL.GetCourseById(id).FirstOrDefault();
         return(Ok(courseobj));
     }
 }