public ActionResult DeleteConfirmed(int id) { BoardSticker boardSticker = db.Stickers.Find(id); var boardId = GetBoardId(boardSticker); db.Stickers.Remove(boardSticker); db.SaveChanges(); return(RedirectToAction("Details", "KanbanBoards", new { id = boardId })); }
public int GetBoardId(BoardSticker sticker) { var allColumns = db.Columns.ToList(); var stickerColumn = allColumns.Where(column => column.Stickers.Contains(sticker)).ToList().Single(); var allBoards = db.Boards.ToList(); var columnBoard = allBoards.Where(board => board.Columns.Contains(stickerColumn)).ToList().Single(); return(columnBoard.KanbanBoardId); }
public ActionResult Edit([Bind(Include = "BoardStickerId,StickerName")] BoardSticker boardSticker) { if (ModelState.IsValid) { db.Entry(boardSticker).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(boardSticker)); }
public ActionResult Create([Bind(Include = "BoardStickerId,StickerName")] BoardSticker boardSticker, int?columnId, int?boardId) { if (ModelState.IsValid) { db.Columns.Find(columnId).Stickers.Add(boardSticker); db.SaveChanges(); return(RedirectToAction("Details", "KanbanBoards", new { id = boardId })); } return(View(boardSticker)); }
// GET: BoardStickers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BoardSticker boardSticker = db.Stickers.Find(id); if (boardSticker == null) { return(HttpNotFound()); } return(View(boardSticker)); }