コード例 #1
0
ファイル: AdController.cs プロジェクト: RTUITLab/StuDo-Back
        public async Task <IActionResult> AddToBookmarks(Guid adId)
        {
            try
            {
                await adManager.AddToBookmarks(adId, GetCurrentUserId());

                return(Ok(adId));
            }
            catch (InvalidOperationException ioe)
            {
                logger.LogDebug(ioe.Message + "\n" + ioe.StackTrace);
                return(NotFound("Can't find ad or user"));
            }
            catch (ArgumentNullException ane)
            {
                logger.LogDebug(ane.Message + "\n" + ane.StackTrace);
                return(NotFound("Can't find ad ot user"));
            }
            catch (ArgumentException ae)
            {
                logger.LogDebug(ae.Message + "\n" + ae.StackTrace);
                return(BadRequest("Already in bookmarks"));
            }
            catch (Exception ex)
            {
                logger.LogDebug(ex.Message + "\n" + ex.StackTrace);
                return(StatusCode(500));
            }
        }