private static void AddLinkModelToList(LinkModel linkModel, List list) { if (linkModel != null && linkModel.Url.IsValidUrl()) { if (list.Links == null) list.Links = new List<Link>(); Link link = linkModel.CreateLink(); list.Links.Add(link); } }
public static LinkModel CreateLinkModel(this Link link) { if (link == null) return null; var linkModel = new LinkModel { Id = link.Id.ToString(), Title = link.Text, Url = link.Url }; return linkModel; }