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 })); }
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); } }
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 })); }
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)); }
public JsonResult GetNotes(int?id) { ICollection <NoteModel> notes = BoardQueries.GetBoardNotes((int)id); return(Json(notes, JsonRequestBehavior.AllowGet)); }