public IActionResult PostFavoriteNews([FromBody] News news) { if (Request != null && Request.Method == HttpMethods.Options) { return(StatusCode((int)HttpStatusCode.OK, true)); } try { if (news != null && !String.IsNullOrEmpty(news.title)) { var item = _newsService.AddFavoriteNews(news); return(StatusCode((int)HttpStatusCode.Created, item)); } else { return(StatusCode((int)HttpStatusCode.BadRequest)); } } catch (SqlException) { return(StatusCode((int)HttpStatusCode.InternalServerError, "DB Error: Failed to Add News to Favorite")); } catch (Exception) { return(StatusCode((int)HttpStatusCode.InternalServerError, "Failed to Add News to Favorite")); } }