示例#1
0
        public static Link CreateLink(this LinkModel model)
        {
            if (model == null)
                return null;

            var link = new Link
                           {
                               Id = model.Id.ToLongOrDefault(),
                               Text = model.Title,
                               Url = model.Url
                           };

            return link;
        }
示例#2
0
        private static void AddLinkToListModel(Link link, ListModel listModel)
        {
            if (link != null && link.Url.IsValidUrl())
            {
                if (listModel.Links == null)
                    listModel.Links = new List<LinkModel>();

                LinkModel linkModel = link.CreateLinkModel();

                listModel.Links.Add(linkModel);
            }
        }