Ejemplo n.º 1
0
        [ProducesResponseType(typeof(CourseUpdateResources), 404)] //請求的資源不存在
        public async Task <IActionResult> UpdateAsync([FromRoute] int Course_Id, [FromBody] CourseUpdateResources resources)
        {
            #region 修改課程
            string result = string.Empty;
            //判斷使用者是否登入
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            resources.Course_Id = Course_Id;
            result = await _CourseServices.UpdateCourse(Course_Id, resources);

            if (result == "OK")
            {
                return(Ok(new { msg = "修改成功" }));
            }
            else
            {
                return(BadRequest(new { msg = "輸入格式錯誤!" }));
            }

            #endregion
        }
Ejemplo n.º 2
0
 public bool UpdateCourse(Course course)
 {
     _courseServices.UpdateCourse(course.Id, course.Name, course.Name, course.EctsCredits);
     return(true);
 }