//lấy thông tin chi tiết 1 bài viết public ListNewsWebOutputModel GetNewsDetail(int ID) { try { ListNewsWebOutputModel newsDetail = new ListNewsWebOutputModel(); var query = (from n in cnn.News join u in cnn.Users on n.CreateUserID equals u.UserID where n.IsActive.Equals(SystemParam.ACTIVE) && n.ID.Equals(ID) select new ListNewsWebOutputModel { ID = n.ID, Type = n.Type, CategoryID = n.CategoryID, Display = n.DisplayOrder.Value, TypeSend = n.TypeSend, Status = n.Status, Title = n.Title, Depcription = n.Description, Content = n.Content, UrlImage = n.UrlImage, CreateUserID = n.CreateUserID, CreateUserName = u.UserName }).FirstOrDefault(); if (query != null && query.ID > 0) { return(newsDetail = query); } return(newsDetail); } catch { return(new ListNewsWebOutputModel()); } }
//[UserAuthenticationFilter] public PartialViewResult GetNewsDetail(int ID) { try { ListNewsWebOutputModel newsDetail = newsBusiness.GetNewsDetail(ID); return(PartialView("_UpdateNews", newsDetail)); } catch { return(PartialView("_UpdateNews", new ListNewsWebOutputModel())); } }