Example #1
0
        public IController CreateController(HttpContext context, RouteMeta meta)
        {
            string ControllerNmae = meta.Controller;

            if (meta.Controller == null)
                return null;

            Type controllerType = GetController(ControllerNmae);  // GetController(meta.Controller);

            IController result = (IController)Activator.CreateInstance(controllerType);

            result.Context = context;
            result.Request = context.Request;

            return result;
        }
Example #2
0
        //public void Execute(HttpContext context, RouteMeta routeData)
        //{
        //    String actionName = routeData.Action;
        //    MethodInfo action = FindAction(actionName);
        //    if (actionName == null || action == null)
        //        return null;
        //    actionName = action.Name;
        //    InvokeAction(action);
        //    string html = "";
        //    foreach (KeyValuePair<string, object> listOfparams in this.ViewData)
        //    {
        //        html += "Params" + listOfparams.Key + "----" + "value" + listOfparams.Value;
        //    }
        //    Render(context,actionName);
        //    return html.ToString() ?? "";
        //}
        public void Execute(HttpContext context, RouteMeta routeData)
        {
            String actionName = routeData.Action;
            MethodInfo action = FindAction(actionName);

            //if (actionName == null || action == null)
            //    return null;

            actionName = action.Name;

            InvokeAction(action);

            string html = "";

            foreach (KeyValuePair<string, object> listOfparams in this.ViewData)
            {
                html += "Params" + listOfparams.Key + "----" + "value" + listOfparams.Value;
            }
            Render(context, actionName);

            //return html.ToString() ?? "";
        }