public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Group")] Pathfinders pathfinders) { if (id != pathfinders.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pathfinders); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PathfindersExists(pathfinders.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pathfinders)); }
void Awake() { if (TileGameObject == null) { TileGameObject = Resources.Load <GameObject>("Prefabs/TilePrefab"); } TileGrid = new GameObject[Size, Size]; TileHighlighters = new TileHighlight[Size, Size]; for (var i = 0; i < Size; i++) { for (var j = 0; j < Size; j++) { var position = new Vector3((Scale * i) - Offset, 0, (Scale * j) - Offset); var cube = Instantiate(TileGameObject, position, Quaternion.identity); var tile = cube.GetComponentInChildren <Pathfinder>(); var highlight = cube.GetComponentInChildren <TileHighlight>(); TileHighlighters[i, j] = highlight; tile.Coordinates = new Vector2Int(i, j); tile.FinishPath += FinishPath; tile.AddPath += AddPath; tile.IsLastPath += (coords) => Path.Last.Value == coords; tile.RemoveLastPath += () => Path.RemoveLast(); Pathfinders.AddLast(tile); TileGrid[i, j] = cube; } } }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Group")] Pathfinders pathfinders) { if (ModelState.IsValid) { _context.Add(pathfinders); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pathfinders)); }