예제 #1
0
        public ActionResult PostNote(int?id, string text, string type, byte[] image)
        {
            NoteModel note = new NoteModel()
            {
                Type    = type,
                BoardId = (int)id,
                left    = 0,
                top     = 0
            };

            switch (type)
            {
            case "Text":
            {
                note.Text = text;
                break;
            }

            case "Image":
            {
                note.Image = image;
                break;
            }

            default:
            {
                return(Json(new { success = false }));
            }
            }
            int noteId = BoardQueries.AddNewNote((int)id, note);

            return(Json(new { success = true, id = noteId }));
        }
예제 #2
0
        public void MoveNote(int boardId, int noteId, float left, float top)
        {
            bool wasUpdated = BoardQueries.UpdateNoteCoord(noteId, left, top);

            if (wasUpdated)
            {
                Clients.OthersInGroup(boardId.ToString()).moveClientNote(noteId, left, top);
            }
        }
예제 #3
0
        public ActionResult DeleteBoard(int?id)
        {
            ApplicationUser user    = AccountQueries.GetCurrentUser(User.Identity.Name);
            bool            success = BoardQueries.DeleteBoard(user, (int)id);

            if (success)
            {
                string boardSuccesfullyDeleted = WebResources.BoardDeleteSuccess;
                return(Json(new { success = true, message = boardSuccesfullyDeleted }));
            }

            string boardDeletionFailed = WebResources.BoardDeleteFailure;

            return(Json(new { success = false, message = boardDeletionFailed }));
        }
예제 #4
0
        public ActionResult Index(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Hub"));
            }
            //!! Add restrictions for users not allowed in a certain board.
            BoardModel currentBoard = BoardQueries.GetBoardInfo((int)id);

            if (currentBoard == null)
            {
                return(RedirectToAction("Index", "Hub"));
            }

            BoardQueries.UpdateBoardVisit((int)id, User.Identity.Name);
            return(View(currentBoard));
        }
예제 #5
0
        public JsonResult GetNotes(int?id)
        {
            ICollection <NoteModel> notes = BoardQueries.GetBoardNotes((int)id);

            return(Json(notes, JsonRequestBehavior.AllowGet));
        }