Ejemplo n.º 1
0
 /// <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));
 }
Ejemplo n.º 2
0
 /// <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)));
 }
Ejemplo n.º 3
0
 /// <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));
 }
Ejemplo n.º 4
0
 /// <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)));
 }
Ejemplo n.º 5
0
 /// <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));
 }
Ejemplo n.º 6
0
 /// <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));
 }
Ejemplo n.º 7
0
 /// <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)));
 }