Ejemplo n.º 1
0
 public OutfitViewModel()
 {
     using (AppContext context = new AppContext()) {
         context.Players.Load();
         Outfit = GetPlayerCollection(context.Players.Local);
     }
 }
Ejemplo n.º 2
0
        private void AddPlayerExecute(object arg)
        {
            using (var context = new AppContext()) {
                var player = context.Players.Create();

                player.Active = true;
                player.Handle = "Default";
                player.FavoriteClass = "Default";
                player.FavoriteVehicle = "Default";
                player.JoinDate = System.DateTime.Now;
                player.Rank = "Default";
                player.Server = "Default";

                context.Players.Add(player);
                context.SaveChanges();

                PlayerModel model = new PlayerModel(player);
                Outfit.Add(model);
            }
        }
Ejemplo n.º 3
0
 private void UpdatePlayerExecute(object arg)
 {
     using (AppContext context = new AppContext()) {
         PlayerEntity player = context.Players.First(x => x.Id == selectedPlayer.Id);
         context.Entry(player).CurrentValues.SetValues(selectedPlayer);
         context.SaveChanges();
         Outfit[Outfit.IndexOf(selectedPlayer)] = selectedPlayer;
     }
 }
Ejemplo n.º 4
0
 private void RemovePlayerExecute(object arg)
 {
     using (AppContext context = new AppContext()) {
         PlayerEntity player = context.Players.First(x => x.Id == selectedPlayer.Id);
         context.Players.Remove(player);
         context.SaveChanges();
         Outfit.Remove(selectedPlayer);
     }
 }