예제 #1
0
        public string BeginForm(string action, string controller, FormActions verb)
        {
            var form = new StringBuilder();
            var url  = String.Format("~/{0}/{1}", controller, action);

            form.AppendFormat("<form action='{0}' method='{1}'>", VirtualPathUtility.ToAbsolute(url), verb.ToString());

            return(form.ToString());
        }
예제 #2
0
        public string Form <T>(Expression <Func <T, ActionResult> > action, FormActions verb)
        {
            var expression = (MethodCallExpression)action.Body;
            var function   = action.Compile();
            //string value = function(this.Model);

            var form = new StringBuilder();
            var url  = String.Format("~/{0}/{1}", expression.Method.ReflectedType.Name.Replace("Controller", ""), expression.Method.Name);

            form.AppendFormat("<form action='{0}' method='{1}'>", VirtualPathUtility.ToAbsolute(url), verb.ToString());


            return(form.ToString());
        }