public ActionResult Index()
        {
            //UserManager<ApplicationUser> manager = new UserManager<ApplicationUser>();
            //UserManager<ApplicationUser> manager = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
            string          user_id = User.Identity.GetUserId();
            ApplicationUser me      = repository.Users.FirstOrDefault(u => u.Id == user_id);

            List <Board> boards   = repository.GetBoards(me);
            Board        my_board = null;

            if (boards.Count() == 0)
            {
                my_board = repository.CreateBoard("My Board", me);
            }
            else
            {
                my_board = boards.First();
            }
            ViewBag.Title          = my_board.Title;
            ViewBag.CurrentBoardId = my_board.BoardId;

            //bool successful = repository.AddList(my_board.BoardId, new BrelloList { Title = "ToDo" });

            List <BrelloList> board_lists = repository.GetAllLists(my_board.BoardId);

            return(View(board_lists));
        }
Example #2
0
        public HttpResponseMessage Get()
        {
            var repo             = new BoardRepository();
            var response         = Request.CreateResponse();
            var ProjectBoardRepo = repo.GetBoards();

            List <ProjectBoardViewModel> ProjectBoards = new List <ProjectBoardViewModel>();

            foreach (var Board in ProjectBoardRepo)
            {
                ProjectBoards.Add(new ProjectBoardViewModel {
                    BoardId = Board.BoardId, Client = Board.Client, Name = Board.Name, UpdateDate = Board.UpdateDate, User = Board.User
                });
            }

            response.Content = new StringContent(JsonConvert.SerializeObject(ProjectBoards));
            HttpContext.Current.Cache.Remove("columns");
            return(response);
        }
        public void BoardRepositoryCanGetABoard()
        {
            /* Begin Arrange */
                my_list.Add(new Board { Title = "Tim's Board", Owner = user1 });
                my_list.Add(new Board { Title = "Sally's Board", Owner = user2 });
                ConnectMocksToDataSource();

                /* Leveraging the CreateBoard Method:
                     mock_boards.Setup(m => m.Add(It.IsAny<Board>())).Callback((Board b) => my_list.Add(b));
                     Board added_board = board_repo.CreateBoard(title, owner);
                */

                BoardRepository board_repository = new BoardRepository(mock_context.Object);
                /* Begin Act */
                List<Board> user_boards = board_repository.GetBoards(user1);
                /* Begin Assert */
                Assert.AreEqual(1, user_boards.Count());
                Assert.AreEqual("Tim's Board", user_boards.First().Title);
        }
        public void BoardRepositoryCanGetABoard()
        {
            /* Begin Arrange */
            my_list.Add(new Board {
                Title = "Tim's Board", Owner = user1
            });
            my_list.Add(new Board {
                Title = "Sally's Board", Owner = user2
            });
            ConnectMocksToDataSource();

            /* Leveraging the CreateBoard Method:
             *   mock_boards.Setup(m => m.Add(It.IsAny<Board>())).Callback((Board b) => my_list.Add(b));
             *   Board added_board = board_repo.CreateBoard(title, owner);
             */

            BoardRepository board_repository = new BoardRepository(mock_context.Object);
            /* Begin Act */
            List <Board> user_boards = board_repository.GetBoards(user1);

            /* Begin Assert */
            Assert.AreEqual(1, user_boards.Count());
            Assert.AreEqual("Tim's Board", user_boards.First().Title);
        }