ButlerWeb.Areas.Butler.Controllers.WelcomeController.Index C# (CSharp) Method

Index() public method

public Index ( ) : System.Web.Mvc.ActionResult
return System.Web.Mvc.ActionResult
        public ActionResult Index()
        {
            Assembly targetAssembly = Assembly.GetExecutingAssembly(); // or whichever
            List<DocumentTypeWrapper> subtypes =
                targetAssembly.GetTypes()
                              .Where(t => t.IsSubclassOf(typeof (ButlerDocument)) && t.IsPublic)
                              .Select(t => new DocumentTypeWrapper(t))
                              .ToList();

            var vm = new WelcomeViewModel();
            vm.Types = subtypes;
            foreach (DocumentTypeWrapper type in vm.Types)
            {
                type.Name = Attributes.GetName(type.Type);
            }

            return View(vm);
        }
WelcomeController