/// <summary> /// Begins a <see cref="CommandForm{T}"/>, with default <see cref="FormMethod.Post"/> as method /// </summary> /// <typeparam name="T">Type of Command to create form for</typeparam> /// <typeparam name="TC">Type of controller holding the action to forward to</typeparam> /// <param name="AjaxHelper">AjaxHelper to begin a command form within</param> /// <param name="ajaxOptions">Ajax Options for the command form</param> /// <param name="expression">Expression holding information about the action on the controller to use</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to be set for the element</param> /// <returns>A <see cref="CommandForm{T}"/></returns> /// <remarks> /// For the expression that expressed the action to use, it does not care about the parameters for the action, so these /// can be set to null. The expression just represents the action strongly typed. /// </remarks> public static CommandForm <T> BeginCommandForm <T, TC>(this AjaxHelper AjaxHelper, Expression <Func <TC, ActionResult> > expression, AjaxOptions ajaxOptions, object htmlAttributes) where T : ICommand, new() where TC : ControllerBase { var command = AjaxHelper.BeginCommandForm <T, TC>(expression, ajaxOptions, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); return(command); }
/// <summary> /// Begins a <see cref="CommandForm{T}"/>, with default <see cref="FormMethod.Post"/> as method /// </summary> /// <typeparam name="T">Type of Command to create form for</typeparam> /// <typeparam name="TC">Type of controller holding the action to forward to</typeparam> /// <param name="AjaxHelper">AjaxHelper to begin a command form within</param> /// <param name="ajaxOptions">Ajax Options for the command form</param> /// <param name="expression">Expression holding information about the action on the controller to use</param> /// <returns>A <see cref="CommandForm{T}"/></returns> /// <remarks> /// For the expression that expressed the action to use, it does not care about the parameters for the action, so these /// can be set to null. The expression just represents the action strongly typed. /// </remarks> public static CommandForm <T> BeginCommandForm <T, TC>(this AjaxHelper AjaxHelper, Expression <Func <TC, ActionResult> > expression, AjaxOptions ajaxOptions = null) where T : ICommand, new() where TC : ControllerBase { var command = AjaxHelper.BeginCommandForm <T, TC>(expression, ajaxOptions, new Dictionary <string, object>()); return(command); }
/// <summary> /// Begins a <see cref="CommandForm{T}"/>, with default <see cref="FormMethod.Post"/> as method /// </summary> /// <typeparam name="T">Type of Command to create form for</typeparam> /// <typeparam name="TC">Type of controller holding the action to forward to</typeparam> /// <param name="AjaxHelper">AjaxHelper to begin a command form within</param> /// <param name="ajaxOptions">Ajax Options for the command form</param> /// <returns>A <see cref="CommandForm{T}"/></returns> /// <remarks> /// For the expression that expressed the action to use, it does not care about the parameters for the action, so these /// can be set to null. The expression just represents the action strongly typed. /// </remarks> public static CommandForm <T> BeginCommandForm <T, TC>(this AjaxHelper AjaxHelper, AjaxOptions ajaxOptions = null) where T : ICommand, new() where TC : ControllerBase { var action = ControllerHelpers.GetActionForCommand <T, TC>(); var controllerName = ControllerHelpers.GetControllerNameFromType <TC>(); var command = AjaxHelper.BeginCommandForm <T>(action.Name, controllerName, ajaxOptions); return(command); }
/// <summary> /// Begins a CommandForm /// </summary> /// <typeparam name="T">Type of Command to create form for</typeparam> /// <param name="AjaxHelper">AjaxHelper to begin a command form within</param> /// <param name="actionName">Action to call on the controller</param> /// <param name="controllerName">Controller the action belongs to</param> /// <param name="ajaxOptions">Ajax Options for the command form</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to be set for the element</param> /// <returns>A <see cref="CommandForm{T}"/></returns> public static CommandForm <T> BeginCommandForm <T>(this AjaxHelper AjaxHelper, string actionName, string controllerName, AjaxOptions ajaxOptions, object htmlAttributes) where T : ICommand, new() { return(AjaxHelper.BeginCommandForm <T>(actionName, controllerName, ajaxOptions, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes))); }
/// <summary> /// Begins a CommandForm /// </summary> /// <typeparam name="T">Type of Command to create form for</typeparam> /// <param name="AjaxHelper">AjaxHelper to begin a command form within</param> /// <param name="actionName">Action to call on the controller</param> /// <param name="controllerName">Controller the action belongs to</param> /// <param name="ajaxOptions">Ajax Options for the command form</param> /// <returns>A <see cref="CommandForm{T}"/></returns> public static CommandForm <T> BeginCommandForm <T>(this AjaxHelper AjaxHelper, string actionName, string controllerName, AjaxOptions ajaxOptions) where T : ICommand, new() { return(AjaxHelper.BeginCommandForm <T>(actionName, controllerName, ajaxOptions, new Dictionary <string, object>())); }