Esempio n. 1
0
        public void GetUserProjects_Test()
        {
            ProjectManagement manager = new ProjectManagement(new ApplicationDbContext());
            var projects = manager.GetUserProjects(userTestId);

            Assert.IsNotNull(projects);
        }
Esempio n. 2
0
        //public ActionResult ListAllProjectsByUser(string userProject)
        //{
        //    string input = HttpUtility.HtmlEncode(userProject);
        //    var projectsForUser = db.ProjectUsers.Select(s => s.ApplicationUser.Email).Distinct().ToList();
        //    ViewBag.listOfProjects = new SelectList(projectsForUser);
        //    var filtedProjects = db.ProjectUsers.Where(s => s.ApplicationUser.Email == input).ToList();
        //    return View(filtedProjects);
        //}

        public ActionResult ListAllProjectsByUser()
        {
            if (User.Identity.IsAuthenticated)
            {
                var userId             = User.Identity.GetUserId();
                var allProjectsForUser = projectManager.GetUserProjects(userId).ToList();
                return(View("Index", allProjectsForUser));
            }
            ViewBag.Message = "Please Log in to view this page";
            return(View());
        }