public void UpdateTerritoryType(EntitiesLayer.TerritoryType territoryType) { DataAccessLayer.ThronesTournamentEntities bdd = new ThronesTournamentEntities(); Territory_Type objEntity = bdd.TerritoriesTypes.FirstOrDefault(t => t.Id == territoryType.ID); objEntity.type = territoryType.Type; bdd.SaveChanges(); }
public void DeleteTerritoryType(int id) { DataAccessLayer.ThronesTournamentEntities bdd = new ThronesTournamentEntities(); Territory_Type objEntity = bdd.TerritoriesTypes.FirstOrDefault(t => t.Id == id); bdd.TerritoriesTypes.Remove(objEntity); bdd.SaveChanges(); }
public void AddTerritoryType(EntitiesLayer.TerritoryType territoryType) { DataAccessLayer.ThronesTournamentEntities bdd = new ThronesTournamentEntities(); var newTerritoryType = new Territory_Type(); newTerritoryType.type = territoryType.Type; bdd.TerritoriesTypes.Add(newTerritoryType); bdd.SaveChanges(); }
private EntitiesLayer.TerritoryType ConvertToTerritoryType(Territory_Type element) { EntitiesLayer.TerritoryType territoryType = new EntitiesLayer.TerritoryType(); if (element != null) { territoryType.ID = element.Id; territoryType.Type = element.type; } else { territoryType = null; } return(territoryType); }