Пример #1
0
        public IActionResult Post([FromBody] EnrolledCourse enrolledCourse)
        {
            if (ModelState.IsValid)
            {
                bool result = repository.AddEnrolledCourses(enrolledCourse);
                if (result)
                {
                    return(Created("AddCoursesEnrolled", enrolledCourse));
                }
                return(BadRequest(new { Message = "You have already Enrolled for This Course." }));

                //return StatusCode(StatusCodes.Status500InternalServerError);
            }
            return(BadRequest(ModelState));
        }