public ActionResult Editor()
        {
            ViewBag.Ad = LoginName;
            List <Comment> comment = new List <Comment>();

            comment = comments.GetAll();
            return(View(comment));
        }
        public ActionResult News_Details(int newsId)
        {
            News_DetailModel model = new News_DetailModel();

            model.Comments          = comments.GetAll().Where(x => x.HaberId == newsId).ToList();
            model.News              = news.GetById(newsId);
            model.News.ViewsCounter = model.News.ViewsCounter + 1;
            news.Update(model.News);
            return(View(model));
        }
Пример #3
0
        public ActionResult Index(int?SayfaNo)
        {
            int        _sayfaNo   = SayfaNo ?? 1;
            IndexModel indexModel = new IndexModel();

            indexModel.CategoryList = category.GetAll();
            indexModel.GalleryList  = gallery.GetAll();
            indexModel.NewsList     = news.GetAll().OrderByDescending(X => X.NewsId).ToPagedList <News>(_sayfaNo, 8);
            indexModel.CommentList  = comment.GetAll();
            return(View(indexModel));
        }
Пример #4
0
        public async Task GetAll_ShouldReturnAllComments()
        {
            var mock   = new Mock <ICommentRepository>();
            var dbList = DbInitializer.GenerateListOfComment();

            mock.Setup(repo => repo.GetAll()).Returns(Task.FromResult(dbList as IEnumerable <Comment>));
            var controller = new CommentController(mock.Object);

            var actionResult = await controller.GetAll();

            Assert.IsNotNull(actionResult);

            OkObjectResult result = actionResult as OkObjectResult;

            Assert.IsNotNull(result);

            var resultValue = result.Value as List <CommentEnhanceDTO>;

            Assert.AreEqual(dbList.Count, resultValue.Count);
        }