Exemple #1
0
        public static void GetArticle(ArticleEditVM vm, ref Article article)
        {

            if (article == null)
            {
                article = new Article();
            }

            if (vm != null)
            {
                article.HeaderBG = vm.HeaderBG;
                article.HeaderEN = vm.HeaderEN;
                article.TextBG = vm.TextBG;
                article.TextEN = vm.TextEN;
                article.IsImportant = vm.IsImportant;
            }
        }
        public virtual ActionResult Edit(Guid id)
        {
            var article = unitOfWork.ArticleRepository.GetByID(id);
            if (article == null)
                article = new Article()
                {
                    ArticleId = id
                };
            var vm = ArticleMapper.GetVM(article);
            vm.AvailableHashtags = unitOfWork.HashtagRepository.Get().OrderBy(e => e.TextBG).Select(e => new SelectListItem()
                {
                    Value = e.HashtagId.ToString(),
                    Text = e.TextBG
                });

            return View(vm);
        }
Exemple #3
0
        public static ArticleEditVM GetVM(Article article)
        {
            var vm = new ArticleEditVM();

            if (article == null)
                article = new Article()
                {
                    ArticleId = Guid.NewGuid()
                };

            vm.ArticleId = article.ArticleId;
            vm.FileName = article.FileName;
            vm.HeaderBG = article.HeaderBG;
            vm.HeaderEN = article.HeaderEN;
            vm.TextBG = article.TextBG;
            vm.TextEN = article.TextEN;
            vm.IsImportant = article.IsImportant;
            vm.HashtagIds = article.ArticlesHashtagsXRefs.Select(e => e.HashtagId).ToList();

            return vm;
        }