/// <summary> /// Adds a route for the resource type <typeparamref name="T"/> and marks the <see cref="HttpVerb.Post"/> verb as allowed. /// </summary> /// <typeparam name="T">A model class that implements <see cref="IApiModel"/></typeparam> public static IPostRoute <T> OnPost <T>(this FluentWebApiRequest request, T model = default(T)) where T : class, IApiModel { return(OnVerb <T>(HttpVerb.Post)); }
/// <summary> /// Adds a route for the resource type <typeparamref name="T"/> and marks the <see cref="HttpVerb.Put"/> verb as allowed. /// The route will also have an ID parameter to identify the resource being updated (or created), /// using the values stored in the model. /// </summary> /// <typeparam name="T">A model class that implements <see cref="IApiModel"/></typeparam> /// <typeparam name="TKey">The type of the key that identifies the model</typeparam> /// <returns></returns> public static IPutRoute <T, TKey> OnPut <T, TKey>(this FluentWebApiRequest request, Expression <Func <TKey, T> > expression = null) where T : class, IApiModel { return(OnVerb <T, TKey>(HttpVerb.Put, default(TKey))); }
/// <summary> /// Adds a route for the resource type <typeparamref name="T"/> and marks the <see cref="HttpVerb.Get"/> verb as allowed. /// The route will also have an ID parameter to identify the resource being retrieved. /// </summary> /// <typeparam name="T">A model class that implements <see cref="IApiModel"/></typeparam> /// <typeparam name="TKey">The type of the key that identifies the model</typeparam> public static IGetByIdRoute <T, TKey> OnGet <T, TKey>(this FluentWebApiRequest request, Expression <Func <TKey, T> > expression, IDictionary <string, string> routeDictionary) where T : class, IApiModel { return(OnVerb <T, TKey>(HttpVerb.Get, default(TKey), routeDictionary)); }
/// <summary> /// Adds a route for the resource type <typeparamref name="T"/> and marks the <see cref="HttpVerb.Get"/> verb as allowed. /// The route will also have an ID parameter to identify the resource being retrieved. /// </summary> /// <typeparam name="T">A model class that implements <see cref="IApiModel"/></typeparam> /// <typeparam name="TKey">The type of the key that identifies the model</typeparam> public static IGetByIdRoute <T, TKey> OnGet <T, TKey>(this FluentWebApiRequest request, object routeDictionary) where T : class, IApiModel { return(OnVerb <T, TKey>(HttpVerb.Get, default(TKey), ToDictionary(routeDictionary))); }
/// <summary> /// Adds a route for the resource type <typeparamref name="T"/> and marks the <see cref="HttpVerb.Get"/> verb as allowed. /// </summary> /// <typeparam name="T">A model class that implements <see cref="IApiModel"/></typeparam> public static IGetRoute <T> OnGet <T>(this FluentWebApiRequest request, Expression <Func <T> > expression = null) where T : class, IApiModel { return(OnVerb <T>(HttpVerb.Get)); }
/// <summary> /// Adds a route for the resource type <typeparamref name="T"/> and marks the custom <paramref name="verb" /> as allowed. /// The route will also have an <paramref name="id"/> parameter to identify the resource being deleted. /// </summary> /// <typeparam name="T">A model class that implements <see cref="IApiModel"/></typeparam> /// <typeparam name="TKey">The type of the key that identifies the model</typeparam> /// <param name="request"></param> /// <param name="verb">A custom HTTP verb.</param> /// <returns></returns> public static Route <T, TKey> OnCustomHttpVerb <T, TKey>(this FluentWebApiRequest request, string verb, TKey id = null) where T : class, IApiModel where TKey : class { return(OnVerb <T, TKey>(HttpVerb.GetVerb(verb), id)); }
/// <summary> /// Adds a route for the resource type <typeparamref name="T"/> and marks the custom <paramref name="verb" /> as allowed. /// </summary> /// <typeparam name="T">A model class that implements <see cref="IApiModel"/></typeparam> /// <param name="request"></param> /// <param name="verb">A custom HTTP verb.</param> /// <returns></returns> public static Route <T> OnCustomHttpVerb <T>(this FluentWebApiRequest request, string verb) where T : class, IApiModel { return(OnVerb <T>(HttpVerb.GetVerb(verb))); }