示例#1
0
 public void DeletePlayer(Player player)
 {
     var dc = new AuctionTrackerContext();
     dc.Players.Attach(player);
     dc.Entry<Player>(player).State = System.Data.Entity.EntityState.Deleted;
     dc.SaveChanges();
     Clients.All.playerDeleted(player);
 }
示例#2
0
        public void UpdatePlayer(Player player, int originalTeamId)
        {
            var dc = new AuctionTrackerContext();
            dc.Players.Attach(player);
            dc.Entry<Player>(player).State = System.Data.Entity.EntityState.Modified;
            dc.SaveChanges();
            player.TeamName = dc.Teams.Single(t => t.ID == player.TeamID).Name;

            Clients.All.playerUpdated(player, originalTeamId);
        }
示例#3
0
        public void AuctionPlayer(Player player)
        {
            var dc = new AuctionTrackerContext();
            dc.Players.Add(player);
            dc.SaveChanges();
            var team = dc.Teams.Where(t => t.Players.Count() < 16).OrderBy(t => t.LastBid).First();
            team.LastBid = DateTime.Now;
            dc.SaveChanges();

            player.TeamName = team.Name;

            Clients.All.playerAuctioned(player);
        }