Esempio n. 1
0
 public IActionResult DeleteTopic(long groupId, long topicId, [FromBody] dynamic json)
 {
     try
     {
         //验证是不是组长
         long userId = User.Id();
         IList <FixGroupMember> fixGroupMemberList = _iFixGroupService.ListFixGroupByGroupId(groupId);
         if (fixGroupMemberList == null)
         {
             throw new FixGroupNotFoundException();
         }
         if (fixGroupMemberList[0].FixGroup.Leader.Id == groupId)
         {
             return(StatusCode(403));
         }
         _iTopicService.DeleteSeminarGroupTopicById(groupId, topicId);
     }
     catch (FixGroupNotFoundException)
     {
         return(NotFound());
     }
     catch (ArgumentException)
     {
         return(BadRequest());
     }
     return(NoContent());
 }
 public IActionResult DeselectTopic([FromRoute] long groupId, [FromRoute] long topicId)
 {
     try
     {
         //小组取消选择话题
         _topicService.DeleteSeminarGroupTopicById(groupId, topicId);
         return(NoContent());
     }
     catch (GroupNotFoundException)
     {
         return(StatusCode(404, new { msg = "该小组不存在" }));
     }
     catch (ArgumentException)
     {
         return(StatusCode(400, new { msg = "组号或话题号格式错误" }));
     }
 }
Esempio n. 3
0
        public IActionResult DeselectTopic([FromRoute] long groupId, [FromRoute] long topicId)
        {
            try
            {
                if (User.Type() != Type.Student)
                {
                    return(StatusCode(403, new { msg = "权限不足" }));
                }

                _topicService.DeleteSeminarGroupTopicById(groupId, topicId);
                return(NoContent());
            }
            catch (GroupNotFoundException)
            {
                return(StatusCode(404, new { msg = "没有找到该课程" }));
            }
            catch (ArgumentException)
            {
                return(StatusCode(400, new { msg = "组号格式错误" }));
            }
        }