示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            UrlBase urlBase = db.UrlBase.Find(id);

            db.UrlBase.Remove(urlBase);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "UrlBaseId,Descripcion,Vigente")] UrlBase urlBase)
 {
     if (ModelState.IsValid)
     {
         db.Entry(urlBase).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(urlBase));
 }
示例#3
0
 string AnonymousWindowCmsJson()
 {
     if (ViewContext.HttpContext.User.Identity.IsAuthenticated)
     {
         return("window.cms = { urlBase: " + UrlBase.ToJavascriptString() + ", isNewUser: true, adminId: " + ViewContext.HttpContext.User.Identity.Name.ToJavascriptString() + " }");
     }
     else
     {
         return("window.cms = { urlBase: " + UrlBase.ToJavascriptString() + " }");
     }
 }
示例#4
0
        public ActionResult Create([Bind(Include = "UrlBaseId,Descripcion,Vigente")] UrlBase urlBase)
        {
            if (ModelState.IsValid)
            {
                db.UrlBase.Add(urlBase);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(urlBase));
        }
示例#5
0
 string AdminWindowCmsJson()
 {
     return
         ("window.cms = { page: { path: " + Page.Path.ToJavascriptString() +
          ", title: " + Page.Title.ToJavascriptString() +
          ", name: " + Page.Name.ToJavascriptString() +
          ", description: " + Page.Description.ToJavascriptString() +
          ", template: " + Page.Template.ToLowerInvariant().ToJavascriptString() +
          ", navigation: " + (Page.Navigation ? "true" : "false") +
          " }, urlBase: " + UrlBase.ToJavascriptString() +
          ", adminId: " + ViewContext.HttpContext.User.Identity.Name.ToJavascriptString() +
          ", templates: " + GetTemplatesJson() +
          ", authType: " + CmsApplication.AuthType.ToJavascriptString() + " }");
 }
示例#6
0
        // GET: Cnp/UrlBases/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UrlBase urlBase = db.UrlBase.Find(id);

            if (urlBase == null)
            {
                return(HttpNotFound());
            }
            return(View(urlBase));
        }
示例#7
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Startup"/> class.
        /// </summary>
        /// <param name="configuration">The application configuration.</param>
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            Options = new Options();
            Configuration.GetSection(Program.AppName).Bind(Options, (o) =>
            {
                o.BindNonPublicProperties = true;
            });

            UrlBase = Options.Web.UrlBase;
            UrlBase = UrlBase.StartsWith("/") ? UrlBase : "/" + UrlBase;

            ContentPath = Path.GetFullPath(Options.Web.ContentPath);

            JwtSigningKey = new SymmetricSecurityKey(Pbkdf2.GetKey(Options.Web.Authentication.Jwt.Key));
        }
示例#8
0
        private string GetLastRealeaseURL()
        {
            if (UrlBase == null)
            {
                throw new ArgumentNullException(nameof(UrlBase), "URLBase not set in DownloadGithubLink class");
            }

            if (Regex.IsMatch(UrlBase, "^http(s?)://github.com/[^/]+/[^/]+/releases/latest/?$"))
            {
                return(UrlBase);
            }
            else if (Regex.IsMatch(UrlBase, "^http(s?)://github.com/[^/]+/[^/]+/releases/tag/[^/]+$"))
            {
                return(UrlBase.Split("tag/").First() + "latest");
            }
            else if (Regex.IsMatch(UrlBase, "^http(s?)://github.com/[^/]+/[^/]+/releases/$"))
            {
                return(UrlBase + "latest");
            }
            else if (Regex.IsMatch(UrlBase, "^http(s?)://github.com/[^/]+/[^/]+/releases$"))
            {
                return(UrlBase + "/latest");
            }
            else if (Regex.IsMatch(UrlBase, "^http(s?)://github.com/[^/]+/[^/]+/$"))
            {
                return(UrlBase + "releases/latest");
            }
            else if (Regex.IsMatch(UrlBase, "^http(s?)://github.com/[^/]+/[^/]+$"))
            {
                return(UrlBase + "/releases/latest");
            }
            else
            {
                throw new ArgumentException("Impossible to parse Github URL", nameof(UrlBase));
            }
        }
示例#9
0
 protected virtual string UrlCompositeHref(string href)
 {
     return(UrlBase.CutAndComposite("/", 0, 3, href));
 }
示例#10
0
 protected override string UrlCompositeHref(string href)
 {
     return(UrlBase.CutAndComposite("/", 0, 5, "/" + href));
 }