public GroupTags_TagViewModel(Tag tag)
 {
     Id = tag.Id;
     Title = tag.Title;
     IsRecomended = tag.IsRecommended;
     Weight = tag.Weight;
 }
 public GroupTopics_TopicViewModel(Tag tag)
 {
     Id = tag.Id;
     Title = tag.Title;
     Description = tag.Description;
     GroupId = tag.GroupId;
     ContentCount = tag.Contents.Count(x=>x.State == (byte)ContentState.Approved);
     ExpertCount = tag.Experts.Count();
 }
Exemple #3
0
 public TagViewModel(Tag tag)
 {
     if (tag != null)
     {
         Id = tag.Id;
         Title = tag.Title;
         IsRecomended = tag.IsRecommended;
         Description = tag.Description;
         Weight = tag.Weight;
     }
 }
Exemple #4
0
        public static Tag CreateTag(string tagTitle, string description, Guid? groupId)
        {
            Guid tmp;
            if (Guid.TryParse(tagTitle, out tmp))
                throw new BusinessLogicException("Некорректное название тэга");

            var tag = new Tag(tagTitle)
                {
                    Description = description,
                    GroupId = groupId,
                };

            DataService.PerThread.TagSet.AddObject(tag);

            return tag;
        }
Exemple #5
0
        private void FixupTag(Tag previousValue)
        {
            if (previousValue != null && previousValue.ExpertVotes.Contains(this))
            {
                previousValue.ExpertVotes.Remove(this);
            }

            if (Tag != null)
            {
                if (!Tag.ExpertVotes.Contains(this))
                {
                    Tag.ExpertVotes.Add(this);
                }
                if (TagId != Tag.Id)
                {
                    TagId = Tag.Id;
                }
            }
        }
 public GroupIndex_TopicViewModel(Tag topic)
 {
     Id = topic.Id;
     Title = topic.Title;
 }
Exemple #7
0
        public static bool UpdateTag(Tag tag, string title, string description)
        {
            var suchtag = GetTag(title, tag.Group);

            if (suchtag == null)
            {
                tag.Description = description;
                tag.ChangeTitle(title);
                return true;
            }

            return false;
        }
Exemple #8
0
        public static void SetTagRecomendation(Tag tag, bool recomended)
        {
            if (tag.TopicState == (byte)TopicState.GroupTopic)
                throw new BusinessLogicException("Нельзя сменить настройки рекомендации у темы группы");

            tag.IsRecommended = recomended;
        }