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(); }
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(); }
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); }
public void AddFight(Fight fight) { _listFights.Add(fight); }
public void UpdateFight(EntitiesLayer.Fight fight) { DataAccessLayer.DALManager manager = DataAccessLayer.DALManager.Instance; manager.DALServer.UpdateFight(fight); }