public virtual ActionResult Edit(Guid id)
        {
            var hashtag = unitOfWork.HashtagRepository.GetByID(id);
            if (hashtag == null)
                hashtag = new Hashtag()
                {
                    HashtagId = id
                };
            var vm = HashtagMapper.GetVM(hashtag);

            return View(vm);
        }
        public static MvcHtmlString HashtagLink(
                this HtmlHelper htmlHelper,
                Hashtag hashtag,
                bool hasMargin = false
            )
        {
            var link = htmlHelper.ActionLink(hashtag.Text, MVC.Search.ActionNames.Index, MVC.Search.Name, new { hashtags = hashtag.HashtagId }, null).ToHtmlString();
            if (hasMargin)
            {
                link = htmlHelper.ActionLink(hashtag.Text, MVC.Search.ActionNames.Index, MVC.Search.Name, new { hashtags = hashtag.HashtagId }, new { @class = "hashtag-link-margin" }).ToHtmlString();
            }

            return new MvcHtmlString(link);
        }
Exemple #3
0
        public static void GetHashtag(HashtagEditVM vm, ref Hashtag hashtag)
        {

            if (hashtag == null)
            {
                hashtag = new Hashtag();
            }

            if (vm != null)
            {
                if (!vm.TextBG.StartsWith("#"))
                    vm.TextBG = "#" + vm.TextBG;
                if (!vm.TextEN.StartsWith("#"))
                    vm.TextEN = "#" + vm.TextEN;
                hashtag.TextBG = vm.TextBG;
                hashtag.TextEN = vm.TextEN;
            }
        }
Exemple #4
0
        public static HashtagEditVM GetVM(Hashtag hashtag)
        {
            var vm = new HashtagEditVM();

            if (hashtag == null)
                hashtag = new Hashtag()
                {
                    HashtagId = Guid.NewGuid()
                };

            vm.HashtagId = hashtag.HashtagId;
            vm.TextBG = hashtag.TextBG;
            vm.TextEN = hashtag.TextEN;

            if (!String.IsNullOrWhiteSpace(vm.TextBG) && vm.TextBG.StartsWith("#"))
                vm.TextBG = vm.TextBG.Substring(1);
            if (!String.IsNullOrWhiteSpace(vm.TextEN) && vm.TextEN.StartsWith("#"))
                vm.TextEN = vm.TextEN.Substring(1);

            return vm;
        }