diff options
author | crupest <crupest@outlook.com> | 2021-04-30 16:52:55 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-04-30 16:52:55 +0800 |
commit | a672e10faad434899d81ef9d0d0d5adbbc7841da (patch) | |
tree | 33c18e4bdad7384c748cf08be1f0569f9a8af619 /BackEnd/Timeline/Controllers/HighlightTimelineController.cs | |
parent | b87abbb8ed0aa86a808b2f97e4d22b0ee1addd9f (diff) | |
download | timeline-a672e10faad434899d81ef9d0d0d5adbbc7841da.tar.gz timeline-a672e10faad434899d81ef9d0d0d5adbbc7841da.tar.bz2 timeline-a672e10faad434899d81ef9d0d0d5adbbc7841da.zip |
refactor: ...
Diffstat (limited to 'BackEnd/Timeline/Controllers/HighlightTimelineController.cs')
-rw-r--r-- | BackEnd/Timeline/Controllers/HighlightTimelineController.cs | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs index ffaa50c1..e73bc7a9 100644 --- a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs +++ b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs @@ -60,16 +60,9 @@ namespace Timeline.Controllers [ProducesResponseType(403)]
public async Task<ActionResult<CommonPutResponse>> Put([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var create = await _service.AddHighlightTimelineAsync(timelineId, this.GetUserId());
- return CommonPutResponse.Create(create);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var create = await _service.AddHighlightTimelineAsync(timelineId, this.GetUserId());
+ return CommonPutResponse.Create(create);
}
/// <summary>
@@ -84,16 +77,9 @@ namespace Timeline.Controllers [ProducesResponseType(403)]
public async Task<ActionResult<CommonDeleteResponse>> Delete([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var delete = await _service.RemoveHighlightTimelineAsync(timelineId, this.GetUserId());
- return CommonDeleteResponse.Create(delete);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var delete = await _service.RemoveHighlightTimelineAsync(timelineId, this.GetUserId());
+ return CommonDeleteResponse.Create(delete);
}
/// <summary>
@@ -113,10 +99,6 @@ namespace Timeline.Controllers await _service.MoveHighlightTimelineAsync(timelineId, body.NewPosition!.Value);
return Ok();
}
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
catch (InvalidHighlightTimelineException)
{
return BadRequest(new CommonResponse(ErrorCodes.HighlightTimelineController.NonHighlight, "Can't move a non-highlight timeline."));
|