public IActionResult UpdateActivity([FromRoute] Guid activityId, [FromBody] ActivityUpdateDto activityUpdateDto) { if (!_activityRepository.ActivityExists(activityId)) { return(NotFound("未找到对应活动")); } var activityFromRepo = _activityRepository.GetActivity(activityId); _mapper.Map(activityUpdateDto, activityFromRepo); _activityRepository.Save(); return(NoContent()); }
public IActionResult GetCommentListForActivityRoute(Guid activityId) { if (!_activityRepository.ActivityExists(activityId)) { return(NotFound("目前暂无评论")); } var CommentFromRepo = _activityRepository.GetCommentByActivityId(activityId); if (CommentFromRepo == null || CommentFromRepo.Count() <= 0) { return(NotFound("评论不存在")); } return(Ok(_mapper.Map <IEnumerable <CommentDto> >(CommentFromRepo))); }