Exemple #1
0
        public virtual ActionResult ProcessKeyword(KeywordProcessForm form = null)
        {
            var count = Repository.SEOKeyword.Count(q => q.ByStatus(SEOKeywordStatus.New));
            var keyword = form.SeoKeywordId > 0
                              ? Repository.SEOKeyword.Get(form.SeoKeywordId)
                              : Repository.SEOKeyword.GetToModerate();

            if (keyword == null)
                return View(MVC.Catalog.Views.NoNewKeyword);

            var model = new KeywordProcessFormModel(keyword);

            model.AvailableCategories =
                Repository.Category.All().Select(c => new SelectListItem {Text = c.Name, Value = c.Id.ToString()});
            model.KeywordProcessForm.SeoKeywordType = keyword.Type;

            if (keyword.Category != null)
                model.KeywordProcessForm.CategoryId = keyword.Category.Id;

            model.NumberOfKeywordsToModerate = count;

            if (form.SeoKeywordId > 0)
                model.KeywordProcessForm = form;

            return View(MVC.Catalog.Views.ProcessKeyword, model);
        }
 public KeywordProcessFormModel(SEOKeyword keyword)
 {
     SeoKeyword = keyword;
     KeywordProcessForm = new KeywordProcessForm { SeoKeywordId = keyword.Id, SeoKeywordPhrase = keyword.Phrase };
 }