コード例 #1
0
        public ActionResult Index()
        {
            if (User.IsInRole("User"))
            {
                return(RedirectToAction("Index", "../Home"));
            }
            List <Project>           allProjects = ProjectDAL.AllProject();
            List <ProjectViewModels> projects    = new List <ProjectViewModels>();

            foreach (var project in allProjects)
            {
                ProjectViewModels item = new ProjectViewModels()
                {
                    ProjectId   = project.ProjectId,
                    ProjectName = project.ProjectName,
                    Description = project.ProjectDescription
                };
                projects.Add(item);
            }

            return(View(projects));
        }