public ActionResult DeleteConfirmed(int id) { UrlBase urlBase = db.UrlBase.Find(id); db.UrlBase.Remove(urlBase); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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() + " }"); } }
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)); }
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() + " }"); }
// 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)); }
/// <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)); }
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)); } }
protected virtual string UrlCompositeHref(string href) { return(UrlBase.CutAndComposite("/", 0, 3, href)); }
protected override string UrlCompositeHref(string href) { return(UrlBase.CutAndComposite("/", 0, 5, "/" + href)); }