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; }
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); } }