示例#1
0
        public ActionResult CreateBoard(AddBoardModel board)
        {
            if (!ModelState.IsValid)
            {
                return(View(board));
            }
            DateTime   current  = DateTime.Now;
            string     userName = User.Identity.Name;
            BoardModel newBoard = new BoardModel()
            {
                LastChanged = current,
                Created     = current,
                Notes       = new Collection <NoteModel>(),
                Name        = board.Name,
                Password    = board.Password,
                IsPrivate   = board.IsPrivate
            };

            //if (newBoard.Password != null)
            //{
            //    newBoard.IsPasswordProtected = true;
            //}
            //else
            //{
            //    newBoard.IsPasswordProtected = false;
            //}
            int?newBoardId = HubQueries.AddBoard(newBoard, userName);

            return(RedirectToAction("Index", "Board", new { id = newBoardId }));
        }
示例#2
0
        public ActionResult Index(string message = null)
        {
            //!!Add Signal-R updates for everyone
            HubModel model = new HubModel();

            model.BoardList = HubQueries.GetAllPublicBoards();
            model.Message   = message;

            foreach (BoardModel board in model.BoardList)
            {
                if (board.Password != null)
                {
                    board.IsPasswordProtected = true;
                }
            }

            return(View(model));
        }