Пример #1
0
        public async Task <IActionResult> Post([FromBody] EnrolledCourse enrolledCourse)
        {
            if (ModelState.IsValid)
            {
                bool result = await repository.AddEnrolledCoursesAsync(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));
        }