예제 #1
0
        public void UpdateFight(EntitiesLayer.Fight fight)
        {
            DataAccessLayer.ThronesTournamentEntities bdd = new ThronesTournamentEntities();
            Fight objEntity = bdd.Fights.FirstOrDefault(f => f.Id == fight.ID);

            objEntity.character1     = fight.FirstCharacter.ID;
            objEntity.character2     = fight.SecondCharacter.ID;
            objEntity.winner         = fight.ID_Winner;
            objEntity.id_war         = fight.ID_War;
            objEntity.teritory_fight = fight.ID_Territory;

            bdd.SaveChanges();
        }
예제 #2
0
        public void AddFight(EntitiesLayer.Fight fight)
        {
            DataAccessLayer.ThronesTournamentEntities bdd = new ThronesTournamentEntities();

            var newFight = new Fight();

            newFight.character1     = fight.FirstCharacter.ID;
            newFight.character2     = fight.SecondCharacter.ID;
            newFight.winner         = fight.ID_Winner;
            newFight.id_war         = fight.ID_War;
            newFight.teritory_fight = fight.ID_Territory;

            bdd.Fights.Add(newFight);

            bdd.SaveChanges();
        }
예제 #3
0
        private EntitiesLayer.Fight ConvertToFight(Fight element)
        {
            EntitiesLayer.Fight fight = new EntitiesLayer.Fight();

            if (element != null)
            {
                fight.ID              = element.Id;
                fight.ID_Territory    = element.teritory_fight;
                fight.ID_Winner       = (int)element.winner;
                fight.FirstCharacter  = GetCharacter(element.character1);
                fight.SecondCharacter = GetCharacter(element.character2);
                fight.ID_War          = element.id_war;
            }
            else
            {
                fight = null;
            }

            return(fight);
        }
예제 #4
0
 public void AddFight(Fight fight)
 {
     _listFights.Add(fight);
 }
예제 #5
0
        public void UpdateFight(EntitiesLayer.Fight fight)
        {
            DataAccessLayer.DALManager manager = DataAccessLayer.DALManager.Instance;

            manager.DALServer.UpdateFight(fight);
        }