예제 #1
0
        public async Task<IActionResult> GetRecommendProjectDetailAsync(int projectId)
        {
            if (!(await _recommendService.IsProjectInRecommend(UserIdentity.UserId, projectId)))
            {
                throw new UserOperationException("无权查看该项目");
            }
            var result = await _projectQueries.GetProjectDetailAsync(projectId);
            return Ok(result);

        }
        public async Task <IActionResult> GetRecommendProjectDetail(int projectId)
        {
            if (!(await _recommendService.IsProjectInRecommend(projectId, UserIdentity.UserId)))
            {
                return(BadRequest("同志,那可不是你能看的项目哦~"));
            }

            var project = await _projectQuery.GetProjectDetailAsync(projectId);

            return(Ok(project));
        }
예제 #3
0
        public async Task <IActionResult> GetRecommendProjectDerail(int projectId)
        {
            if (await _recommendService.IsProjectInRecommend(projectId, UserIdentity.UserId))
            {
                var project = await _projectQueries.GetProjectDetail(projectId);

                return(Ok(project));
            }

            return(BadRequest("无权查看该项目"));
        }
예제 #4
0
        public async Task <IActionResult> ViewProject(int projectId)
        {
            if (await _recommendService.IsProjectInRecommend(projectId, UserIdentity.UserId))
            {
                return(BadRequest());
            }
            var command = new ViewProjectCommand()
            {
                ProjectId = projectId
            };
            var result = await _mediator.Send(command);

            return(Ok(result));
        }
예제 #5
0
        public async Task <IActionResult> ViewProject(int projectId)
        {
            if (await _recommendService.IsProjectInRecommend(projectId, UserIdentity.UserId))
            {
                return(BadRequest("您没有权限查看项目!"));
            }

            var command = new ViewProjectCommand()
            {
                UserId    = UserIdentity.UserId,
                Avatar    = UserIdentity.Avatar,
                ProjectId = projectId,
                UserName  = UserIdentity.Name,
            };

            var result = await _mediator.Send(command);

            return(Ok());
        }