public void UpdateVillage(Village v) { this.Entities.SaveChanges(); }
public void AddVillage(Village v) { this.Entities.Village.AddObject(v); this.Entities.SaveChanges(); }
public void DeleteVillage(Village v) { this.Entities.Village.DeleteObject(v); this.Entities.SaveChanges(); }
private Map GenerateVillages(int amount, CommonLayer.Map map, int width, int height) { Random r = new Random(); int _nameCounter = 65; for (int i = 0; i < amount; i++) { //Temp Values int _CurX = r.Next(width); int _CurY = r.Next(height); string name = "" + Convert.ToChar(_nameCounter); //Create new Village Village v = new Village(); v.ID = Guid.NewGuid(); v.Name = name; v.XCoor = _CurX; v.YCoor = _CurY; v.MapID = map.ID; //Add new Village to Map map.Village.Add(v); //Add plus one to the counter _nameCounter++; } return map; }
public IEnumerable<Road> GetVillageRoads(Village v) { return this.Entities.Road.Where(r => r.VillageFrom == v.ID); }
public Road GetRoadBetween(Village v, Village v2) { return this.Entities.Road.SingleOrDefault(r => r.VillageFrom == v.ID && r.VillageTo == v2.ID); }
/// <summary> /// Create a new Village object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="xCoor">Initial value of the XCoor property.</param> /// <param name="yCoor">Initial value of the YCoor property.</param> /// <param name="mapID">Initial value of the MapID property.</param> public static Village CreateVillage(global::System.Guid id, global::System.String name, global::System.Int32 xCoor, global::System.Int32 yCoor, global::System.Guid mapID) { Village village = new Village(); village.ID = id; village.Name = name; village.XCoor = xCoor; village.YCoor = yCoor; village.MapID = mapID; return village; }
/// <summary> /// Deprecated Method for adding a new object to the Village EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToVillage(Village village) { base.AddObject("Village", village); }