aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-04-30 16:52:55 +0800
committercrupest <crupest@outlook.com>2021-04-30 16:52:55 +0800
commit88002173a1155883d1fb46683a9a7ad1f521eb56 (patch)
tree742cce92b6e424d7bcd4a51a8da63dd10e18c4c7 /BackEnd/Timeline/Controllers/BookmarkTimelineController.cs
parentbf4c48980f81e566065c07f3fe534ce7551ebdcc (diff)
downloadtimeline-88002173a1155883d1fb46683a9a7ad1f521eb56.tar.gz
timeline-88002173a1155883d1fb46683a9a7ad1f521eb56.tar.bz2
timeline-88002173a1155883d1fb46683a9a7ad1f521eb56.zip
refactor: ...
Diffstat (limited to 'BackEnd/Timeline/Controllers/BookmarkTimelineController.cs')
-rw-r--r--BackEnd/Timeline/Controllers/BookmarkTimelineController.cs30
1 files changed, 6 insertions, 24 deletions
diff --git a/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs b/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs
index cbc96fc6..94cb0f3e 100644
--- a/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs
+++ b/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs
@@ -60,16 +60,9 @@ namespace Timeline.Controllers
[ProducesResponseType(401)]
public async Task<ActionResult<CommonPutResponse>> Put([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var create = await _service.AddBookmarkAsync(this.GetUserId(), timelineId);
- return CommonPutResponse.Create(create);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var create = await _service.AddBookmarkAsync(this.GetUserId(), timelineId);
+ return CommonPutResponse.Create(create);
}
/// <summary>
@@ -83,16 +76,9 @@ namespace Timeline.Controllers
[ProducesResponseType(401)]
public async Task<ActionResult<CommonDeleteResponse>> Delete([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var delete = await _service.RemoveBookmarkAsync(this.GetUserId(), timelineId);
- return CommonDeleteResponse.Create(delete);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var delete = await _service.RemoveBookmarkAsync(this.GetUserId(), timelineId);
+ return CommonDeleteResponse.Create(delete);
}
/// <summary>
@@ -112,10 +98,6 @@ namespace Timeline.Controllers
await _service.MoveBookmarkAsync(this.GetUserId(), timelineId, request.NewPosition!.Value);
return Ok();
}
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
catch (InvalidBookmarkException)
{
return BadRequest(new CommonResponse(ErrorCodes.BookmarkTimelineController.NonBookmark, "You can't move a non-bookmark timeline."));