예제 #1
0
        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();
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }
예제 #4
0
        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);
        }