public ActionResult Links(string resourceName)
        {
            var result = new List<ResourceLinkModel>();
            var links = _resourceLinkPersistence.GetLinks(resourceName);
            foreach (var link in links)
            {
                var destinationResource = _resourceDescriptorProvider.GetDescriptor(link.DestinationResourceName);
                var linkModel = new ResourceLinkModel(link, destinationResource);
                result.Add(linkModel);
            }

            return JsonNet(result).UsingClientConvention();
        }
        public ActionResult SaveLink(string sourceResourceName, ResourceLinkModel linkModel)
        {
            ResourceLink link = null;

            if (!String.IsNullOrEmpty(linkModel.Id))
            {
                link = _resourceLinkPersistence.GetById(linkModel.Id);
                linkModel.UpdateTo(link);
                _resourceLinkPersistence.Save(link);
            }
            else
            {
                link = new ResourceLink
                {
                    SourceResourceName = sourceResourceName
                };
                linkModel.UpdateTo(link);
                _resourceLinkPersistence.Save(link);
            }

            return AjaxForm().Success().WithModel(new
            {
                Id = link.Id
            });
        }
 public ActionResult ResourceLink(string linkId)
 {
     var link = _resourceLinkPersistence.GetById(linkId);
     var destinationResource = _resourceDescriptorProvider.GetDescriptor(link.DestinationResourceName);
     var model = new ResourceLinkModel(link, destinationResource);
     return JsonNet(model).UsingClientConvention();
 }