Beispiel #1
0
        /// <summary>
        /// Add cells to the grid
        /// </summary>
        /// <param name="gridId">Grid Id</param>
        /// <param name="x">X dimension size</param>
        /// <param name="y">Y dimension size</param>
        public void Add(int gridId, int x, int y)
        {
            // Add Cells
            int nr = 1;
            Cell cell;
            for (int i = 1; i <= x; i++)
            {
                for (int j = 1; j <= y; j++)
                {
                    cell = new Cell { GridId = gridId, X = j, Y = i, CellNr = nr };
                    _db.Add(cell, true);
                    nr++;
                }
            }

            //Save back to database
            _db.Save();
        }
Beispiel #2
0
 /// <summary>
 /// Remove a cell from database
 /// </summary>
 public void Remove(Cell cell)
 {
     db.Cells.Remove(cell);
     db.SaveChanges();
 }
Beispiel #3
0
 /// <summary>
 /// Add a cell to the database
 /// </summary>
 public void Add(Cell cell, bool saveChanges)
 {
     db.Cells.Add(cell);
     if(saveChanges) db.SaveChanges();
 }
Beispiel #4
0
 /// <summary>
 /// Add a cell to the database
 /// </summary>
 public void Add(Cell cell)
 {
     Add(cell, true);
 }