private static void RegisterArea(System.Web.Mvc.AreaRegistration area, RouteCollection routes) { var context = new AreaRegistrationContext(area.AreaName, routes); context.Namespaces.Add(area.GetType().Namespace); area.RegisterArea(context); }
public Uploader(ILogger logger, AreaRegistration area, HttpFileCollectionBase files, string tenant, string[] allowedExtensions) { this.Logger = logger; this.Area = area; this.Files = files; this.Tenant = tenant; this.AllowedExtensions = allowedExtensions; }
public Deserializer(string tenant, AreaRegistration area, int width, int height, string path) { this.Tenant = tenant; this.Width = width; this.Height = height; this.Path = path; this.ImagePath = PathMapper.MapPath($"/Tenants/{tenant}/Areas/{area.AreaName}/attachments/" + path); }
public RouteData GetAreaRouteData(string url, AreaRegistration areaConfig) { var routes = new RouteCollection(); var areaContext = new AreaRegistrationContext(areaConfig.AreaName, routes); areaConfig.RegisterArea(areaContext); var context = new StubHttpContextForRouting(requestUrl: url); var routeData = routes.GetRouteData(context); return routeData; }
public ActionResult Post() { var area = new AreaRegistration(); var allowed = FrapidConfig.GetAllowedUploadExtensions(this.Tenant); var uploader = new Uploader(Log.Logger, area, this.Request.Files, this.Tenant, allowed); try { string fileName = uploader.Upload(); fileName = "/dashboard/config/services/attachments/" + fileName; return this.Ok(fileName); } catch (UploadException ex) { return this.Failed(ex.Message, HttpStatusCode.BadRequest); } }
private void RegisterRoutesForArea(AreaRegistration areaRegistration) { var context = new AreaRegistrationContext(areaRegistration.AreaName, RouteTable.Routes, null); string areaNamespace = areaRegistration.GetType().Namespace; if (areaNamespace != null) context.Namespaces.Add(areaNamespace + ".*"); areaRegistration.RegisterArea(context); }
public LowercaseDashedRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler, AreaRegistration area, AreaRegistrationContext areaContext, string[] namespaces) : base(url, defaults, constraints, dataTokens, routeHandler) { Url = url; Defaults = defaults; Constraints = constraints; DataTokens = dataTokens; RouteHandler = routeHandler; if (DataTokens == null) DataTokens = new RouteValueDictionary(); if (area != null) { DataTokens["area"] = area.AreaName; if (namespaces == null || namespaces.Length == 0) { namespaces = areaContext.Namespaces.ToArray(); } DataTokens["UseNamespaceFallback"] = (namespaces == null ? true : (int)namespaces.Length == 0); } if (namespaces != null && namespaces.Length > 0) { DataTokens["Namespaces"] = namespaces; } }
public LowercaseDashedRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler, AreaRegistration area, AreaRegistrationContext areaContext) : this(url, defaults, constraints, dataTokens, routeHandler, area, areaContext, null) { }
public LowercaseDashedRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler routeHandler, AreaRegistration area, AreaRegistrationContext areaContext, string[] namespaces) : this(url, defaults, constraints, null, routeHandler, area, areaContext, namespaces) { }
public LowercaseDashedRoute(string url, IRouteHandler routeHandler, AreaRegistration area, AreaRegistrationContext areaContext, string[] namespaces) : this(url, null, null, null, routeHandler, area, areaContext, namespaces) { }
protected void InitNewArea(AreaRegistration areaRegistration, AreaRegistrationContext areaRegistrationContext) { areaRegistration.RegisterArea(areaRegistrationContext); }
public string GetAreaName(AreaRegistration registration) { return registration.GetType().Name.Replace("AreaRegistration", string.Empty); }