示例#1
0
        //Home page - List all actions and all Folders in the system
        public ViewResult Index()
        {
            _logger.LogInformation("Log message in the Index() method");
            IEnumerable <Folder> model = _folderRepository.GetAllFolders();

            return(View(model));
        }
        public void Add_ValidObjectPassed_ReturnsCreatedResponseRedirected()
        {
            //Arrange
            FolderManagement.Models.Folder testFolder = new FolderManagement.Models.Folder()
            {
                ParentFolderId = 1,
                Name           = "TestFolder"
            };

            //Act
            var createdResponse = _controller.Create(testFolder);
            IEnumerable <FolderManagement.Models.Folder> totalFolders = _service.GetAllFolders();

            //Assert
            Assert.IsType <RedirectToActionResult>(createdResponse);
            Assert.Equal(6, totalFolders.Count());
        }
示例#3
0
 public ViewResult Create()
 {
     _logger.LogInformation("Log message in the Create() method");
     ViewBag.Folders = _folderRepository.GetAllFolders();
     return(View());
 }
示例#4
0
 public IActionResult OtherUserInfo()
 {
     if (userGet.HaveUser(HttpContext))
     {
         User user = userGet.GetUser(HttpContext);
         return(Ok(new UserPageUser(user, followerRepository.GetAllFollowersNumber(user), followerRepository.GetAllFollowingNumber(user), folderRepository.GetAllFolders(user))));
         //User otheruser = userRepository.GetUserData(userId);
         //return Ok(new UserPageUser(otheruser, followerRepository.GetAllFollowersNumber(otheruser), followerRepository.GetAllFollowingNumber(otheruser), folderRepository.GetAllFoldersForOther(user, otheruser)));
     }
     return(Unauthorized());
 }