public IActionResult AssignCategory(int newCategory, int newsId) { string authHeader = Request.Headers["Authorization"]; if (secretKey != authHeader) { return(Unauthorized()); } ; if (!CategoryData.Models.Any(n => n.Id == newCategory)) { return(StatusCode(404, $"id: {newCategory} can not add to a non existing category, please create it first")); } _newsService.AssignCategory(newCategory, newsId); return(NoContent()); }