Example #1
0
        public ActionResult Edit(int id)
        {
            var article = _articleRepository.Get(id);

            var attachments = _articleAttachmentRepository.GetAllBy(a => a.ArticleId == article.Id).ToList();
            var versions    = _articleVersionRepository.GetAllBy(a => a.ArticleId == article.Id, o => o.OrderByDescending(a => a.CreatedOn)).ToList();

            var vm = new EditArticleViewModel(article)
            {
                Attachments = attachments,
                Versions    = versions
            };

            ViewBag.CategoryId = new SelectList(_categoryRepository.GetAll(), "Id", "Title", article.CategoryId);

            return(View(vm));
        }