Beispiel #1
0
        public static Lok.Unik.ModelCommon.Client.Tag ToCommonTags(Tag tag, ApplicationUser creatorPrincipal)
        {
            var result = new Lok.Unik.ModelCommon.Client.Tag();

            try
            {
                if (tag != null && !string.IsNullOrEmpty(tag.Name) && !string.IsNullOrEmpty(tag.Category))
                {
                    if (!string.IsNullOrEmpty(tag.Name.Trim()) && !string.IsNullOrEmpty(tag.Category.Trim()))
                    {
                        result = new Lok.Unik.ModelCommon.Client.Tag
                        {
                            Id         = tag.Id,
                            Attribute  = tag.Name,
                            Value      = tag.Name,
                            CreateDate = tag.CreateDate,
                            Category   = TagCategoryUILogic.ToCommonTagCategory(tag.Category, tag.Color),
                            Type       =
                                (TagType)
                                Enum.Parse(typeof(TagType), tag.Type),

                            CreatorPrincipalId = creatorPrincipal == null ? String.Empty : creatorPrincipal.Id
                        }
                    }
                    ;
                }
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("{0} \n {1}", ex.ToString(), ex.InnerException == null ? string.Empty : "InnerException: " + ex.InnerException.ToString());
            }
            return(result);
        }
Beispiel #2
0
        public static Tag ToModelTags(Lok.Unik.ModelCommon.Client.Tag tag)
        {
            var result = new Tag();

            if (tag != null)
            {
                result = new Tag
                {
                    Id       = tag.Id,
                    Name     = tag.Attribute,
                    Category = tag.Category.Name,
                    Color    = tag.Category.Color.ToString(),
                    Type     = tag.Type.ToString()
                }
            }
            ;
            return(result);
        }