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

            if (course == null)
            {
                return(NotFound());
            }
            return(View(course));
        }
        public IActionResult Get(int id)
        {
            var Course = _courseServices.GetCourseById(id);

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