コード例 #1
0
        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 }));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 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));
 }
コード例 #4
0
        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));
        }
コード例 #5
0
        // 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));
        }