public ResourcesBuilder <T> OnMember(Action <RouteBuilder> map, string pathName)
        {
            var options = Utils.MergeOptions(RouteOptions);

            options.Path = Utils.JoinPath(options.Path, $"{{{pathName}Id}}");
            var rb = new RouteBuilder(options);

            map.Invoke(rb);
            Children.Add(rb);
            return(this);
        }
Beispiel #2
0
        public RouteBuilder Map(RouteOptions options, Action <RouteBuilder> map)
        {
            var opts = Utils.MergeOptions(RouteOptions, options);
            var rb   = new RouteBuilder(opts)
            {
                RouteOptions = { Path = Utils.JoinPath(RouteOptions.Path, options.Path) }
            };

            Children.Add(rb);
            map.Invoke(rb);
            return(rb);
        }
Beispiel #3
0
 public ResourceBuilder(string prefix, RouteOptions options)
 {
     RouteOptions = Utils.MergeOptions(options, new RouteOptions {
         ClassHandler = typeof(T)
     });
     RouteOptions.Path = Utils.JoinPath(options.Path, prefix);
     _rb = new RouteBuilder(RouteOptions);
     Children.Add(_rb);
     _rb.Get("/").Action("Show");
     _rb.Post("/").Action("Create");
     _rb.Get("/new").Action("New");
     _rb.Get("/edit").Action("Edit");
     _rb.Path("/").Methods("put", "patch").Action("Update");
     _rb.Delete("/").Action("Delete");
     _rb.Options("/").Action("Options");
     _rb.Options("/new").Action("Options");
     _rb.Options("/edit").Action("Options");
 }
Beispiel #4
0
 public void Map(string prefix, Action <RouteBuilder> action)
 {
     RouteBuilder = new RouteBuilder(prefix);
     action.Invoke(RouteBuilder);
     Compile();
 }