コード例 #1
0
 public IActionResult DeleteNewsItemById(int newsItemId)
 {
     _newsItemService.DeleteNewsItemById(newsItemId);
     _newsItemService.DeleteNewsItemAuthorConnection(newsItemId);
     _newsItemService.DeleteNewsItemCategoriesConnection(newsItemId);
     return(NoContent());
 }
コード例 #2
0
 public IActionResult DeleteNewsItemById(int id)
 {
     if (!_authenticationService.isValidToken(Request.Headers["Authorization"]))
     {
         return(Unauthorized());
     }
     _newsItemService.DeleteNewsItemById(id);
     return(NoContent());
 }
コード例 #3
0
        public IActionResult DeleteNewsItem(int id)
        {
            var authKey = Request.Headers["Authorization"].ToString();

            if (authKey == DataProvider.GetAdminPass())
            {
                _newsItemService.DeleteNewsItemById(id);
                return(NoContent());
            }
            return(StatusCode(401, "User not authorized"));
        }
        public IActionResult DeleteNewsItemById(int id)
        {
            bool success = _newsItemService.DeleteNewsItemById(id);

            if (success)
            {
                return(NoContent());
            }

            return(NotFound());
        }
コード例 #5
0
        public IActionResult DeleteNewsItemById(int id)
        {
            if (Request.Headers["Authorization"] != _authorizationHeader)
            {
                return(BadRequest("Authorization required."));
            }

            try{
                _newsItemService.DeleteNewsItemById(id);
            }
            catch (KeyNotFoundException k) {
                return(BadRequest("No news item with this Id exists."));
            }
            return(NoContent());
        }
コード例 #6
0
 public IActionResult DeleteNewsItemById(int id)
 {
     _newsItemService.DeleteNewsItemById(id);
     return(NoContent());
 }