コード例 #1
0
        public async Task <IHttpActionResult> Post(CourseDTO courseDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                Course course = mapper.Map <Course>(courseDTO);
                course = await courseService.Insert(course);

                return(Ok(course));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }