public async Task <IActionResult> MoveCardLeft(int id) { int focusID = Convert.ToInt32(Request.Cookies["FocusCookie"]); Board board = await _context.Board.Where(b => b.FocusID == focusID) .Include(b => b.Column) .FirstOrDefaultAsync(); Card card = await _context.Card.Where(c => c.ID == id) .Include(c => c.Column) .FirstOrDefaultAsync(); int desiredColumnOrder = card.Column.Order - 1; int?desiredColumnID = board.Column.Where(c => c.Order == desiredColumnOrder) .Select(c => c.ID) .First(); if (desiredColumnID != null) { card.ColumnID = (int)desiredColumnID; await _card.UpdateCard(card); } return(RedirectToAction("Index", "Board")); }