public async Task <HttpResponseMessage> GetNotiNews(int userID, int newsID) { try { NotiNews notiNews = new NotiNews(); NewsDAL dal = new NewsDAL(); NewsInfo data = await dal.GetNewsByID(userID, newsID); notiNews.NewsInfo = data; notiNews.NewsContentInfos = await dal.GetNewsDetail(newsID, userID); if (data != null) { return(Request.CreateResponse <NotiNews>(HttpStatusCode.OK, notiNews)); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound)); } } catch (DbEntityValidationException ex) { var controllerName = ControllerContext.RouteData.Values["controller"].ToString(); var actionName = ControllerContext.RouteData.Values["action"].ToString(); Logger log = new Logger(); log.ErrorLog(ex, controllerName, actionName); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError)); } }