コード例 #1
0
        public IActionResult UpdateSeminarById([FromRoute] long seminarId, [FromBody] Seminar updated)
        {
            if (User.Type() != Type.Teacher)
            {
                return(StatusCode(403, new { msg = "权限不足" }));
            }

            try
            {
                _seminarService.UpdateSeminarBySeminarIdAsync(seminarId, updated);
                return(NoContent());
            }
            catch (SeminarNotFoundException)
            {
                return(StatusCode(404, new { msg = "讨论课不存在" }));
            }
            catch (ArgumentException)
            {
                return(StatusCode(400, new { msg = "讨论课ID输入格式有误" }));
            }
        }