示例#1
0
        public async Task <IActionResult> RemoveFromBookmarks(Guid adId)
        {
            try
            {
                await adManager.RemoveFromBookmarks(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 not in bookmarks"));
            }
            catch (Exception ex)
            {
                logger.LogDebug(ex.Message + "\n" + ex.StackTrace);
                return(StatusCode(500));
            }
        }