/// <summary> /// Configures Fluent Web API to use a custom reply instead of its default behavior when responding to the <paramref name="route"/>. /// </summary> public static IDeleteRoute <T, TKey> ReplyWith <T, TKey>(this IDeleteRoute <T, TKey> route, Func <Responder, TKey, IHttpActionResult> func) where T : class, IApiModel <TKey> { if (route == null) { throw new ArgumentNullException("route"); } if (func == null) { throw new ArgumentNullException("func"); } ((Route <T, TKey>)route).ReplyOnDelete = (r, o) => func(r, (TKey)o); return(route); }
/// <summary> /// Configures the <paramref name="route"/> to use the given <paramref name="method"/> to remove an instance of <typeparamref name="T"/>. /// </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 IDeleteRoute <T, TKey> DeleteUsing <T, TKey>(this IDeleteRoute <T, TKey> route, Action <TKey> method) where T : class, IApiModel <TKey> { if (route == null) { throw new ArgumentNullException("route"); } if (method == null) { throw new ArgumentNullException("method"); } ((Route <T, TKey>)route).Deleter = o => method((TKey)o); return(route); }