示例#1
0
        public ActionResult GetPartialview(string PageCode)
        {
            PartialPagesDAL partialPage = new PartialPagesDAL();
            var             res         = partialPage.GetPartialByPageCode(PageCode);

            return(PartialView("_PartialPages", res));
        }
        public override IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName)
        {
            IController controller = null;
            dynamic     obj        = null;

            switch (controllerName)
            {
            case "Services":
            {
                obj = new ServicesDAL();
                break;
            }

            case "Histories":
            {
                obj = new HistoryDAL();
                break;
            }

            case "Employees":
            {
                obj = new EmployeeDAL();
                break;
            }

            case "AboutClinic":
            {
                obj = new AboutClinicDAL();
                break;
            }

            case "Testimonial":
            {
                obj = new TestimonialsDAL();
                break;
            }

            case "GalleryAdmin":
            {
                obj = new GalleryDAL();
                break;
            }

            case "Gallery":
            {
                obj = new GalleryDAL();
                break;
            }

            case "AdminPartial":
            {
                obj = new PartialPagesDAL();
                break;
            }
            }
            Type controllerType = GetControllerType(requestContext, controllerName);

            if (obj != null)
            {
                controller = Activator.CreateInstance(controllerType, new[] { obj }) as Controller;
            }
            else
            {
                controller = Activator.CreateInstance(controllerType) as Controller;
            }

            return(controller);
        }