Ejemplo n.º 1
0
        public ActionResult Install(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id");
            }
            var projectManager = GetProjectManager();
            var packages       = projectManager.SourceRepository.FindPackagesById(id).OrderByDescending(p => p.Version);

            if (packages == null)
            {
                throw new InvalidOperationException("Package does not exist");
            }
            var package = packages.FirstOrDefault();

            if (package == null)
            {
                throw new InvalidOperationException("Package does not exist");
            }
            projectManager.InstallPackage(package);

            // Get the skin.
            var skinEngine             = new SkinEngine();
            var skinsWithoutMobileOnly = skinEngine.GetSkinTemplatesGroupedByFolder(mobileOnly: false);

            var packageViewModel = new PackageViewModel(package, skinsWithoutMobileOnly, GetSkinIconImage, mobileOnly: false);

            if (Request.IsAjaxRequest())
            {
                return(Json(packageViewModel, JsonRequestBehavior.AllowGet));
            }

            return(View(package));
        }
Ejemplo n.º 2
0
        private IEnumerable <PackageViewModel> GetPackagesFromSkinTemplates(bool mobileOnly)
        {
            var packages = NuGetService.LocalRepository.GetPackages();

            var skinEngine = new SkinEngine();
            var skins      = skinEngine.GetSkinTemplatesGroupedByFolder(mobileOnly: mobileOnly);


            return(from p in packages
                   where skins.ContainsKey(p.Id)
                   select new PackageViewModel(p, skins, GetSkinIconImage, mobileOnly));
        }