public IActionResult DeleteNewsItemById(int newsItemId) { _newsItemService.DeleteNewsItemById(newsItemId); _newsItemService.DeleteNewsItemAuthorConnection(newsItemId); _newsItemService.DeleteNewsItemCategoriesConnection(newsItemId); return(NoContent()); }
public IActionResult DeleteNewsItemById(int id) { if (!_authenticationService.isValidToken(Request.Headers["Authorization"])) { return(Unauthorized()); } _newsItemService.DeleteNewsItemById(id); return(NoContent()); }
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()); }
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()); }
public IActionResult DeleteNewsItemById(int id) { _newsItemService.DeleteNewsItemById(id); return(NoContent()); }