From e536121d97610af09d6bf4a51a875b0f7d50f702 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 30 Apr 2021 17:53:40 +0800 Subject: refactor: ... --- BackEnd/Timeline/Controllers/TimelineController.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BackEnd/Timeline/Controllers/TimelineController.cs') diff --git a/BackEnd/Timeline/Controllers/TimelineController.cs b/BackEnd/Timeline/Controllers/TimelineController.cs index bb770ea0..f04982dc 100644 --- a/BackEnd/Timeline/Controllers/TimelineController.cs +++ b/BackEnd/Timeline/Controllers/TimelineController.cs @@ -82,7 +82,7 @@ namespace Timeline.Controllers } else { - return BadRequest(ErrorResponse.Common.CustomMessage_InvalidModel(Resources.Messages.TimelineController_QueryVisibilityUnknown, item)); + return this.BadRequestWithCommonResponse(ErrorCodes.Common.InvalidModel, string.Format(Resource.MessageTimelineListQueryVisibilityUnknown, visibility)); } } } @@ -100,7 +100,7 @@ namespace Timeline.Controllers } catch (EntityNotExistException) { - return BadRequest(ErrorResponse.TimelineController.QueryRelateNotExist()); + return this.BadRequestWithCommonResponse(ErrorCodes.TimelineController.QueryRelateNotExist, Resource.MessageTimelineListQueryRelateNotExist); } } @@ -143,7 +143,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !await _service.HasManagePermissionAsync(timelineId, this.GetUserId())) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } await _service.ChangePropertyAsync(timelineId, _mapper.AutoMapperMap(body)); @@ -169,7 +169,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !(await _service.HasManagePermissionAsync(timelineId, this.GetUserId()))) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } var userId = await _userService.GetUserIdByUsernameAsync(member); @@ -194,7 +194,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !(await _service.HasManagePermissionAsync(timelineId, this.GetUserId()))) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } @@ -239,7 +239,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !(await _service.HasManagePermissionAsync(timelineId, this.GetUserId()))) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } await _service.DeleteTimelineAsync(timelineId); -- cgit v1.2.3