예제 #1
0
        public HomeViewModel()
        {
            ServicesDAL    objServicesDAL    = new ServicesDAL();
            AboutClinicDAL objAboutClinicDAL = new AboutClinicDAL();

            _Services = objServicesDAL.GetAllServices();
            _Abouts   = objAboutClinicDAL.GetAllAbout();
        }
        public ActionResult Index(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            objAboutClinic = new AboutClinicDAL();
            var AboutClinic = objAboutClinic.GetAbout(id);

            if (AboutClinic == null)
            {
                return(HttpNotFound());
            }
            return(View(AboutClinic));
        }
        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);
        }