Save() public method

public Save ( ) : byte[]
return byte[]
Exemplo n.º 1
0
        public static void SaveNewGame(Game game)
        {
            using (var db = CreateDB())
            {
                db.ExecuteWithParams("insert into game (Status, Serialized, Private) values (@Status, @Serialized, @Private) ", new { Status = game.Status, Serialized = game.Save(), @Private = (game.IsPrivate ? 1 : 0) });
                game.Id = (int)db.LastInsertID;
                if (String.IsNullOrEmpty(game.GameName))
                    game.GameName = "Game #" + game.Id;
            }

            // save the new id
            SaveGame(game);

            // insert into cache
            HttpContext.Current.Cache[game.Id.ToString()] = game;
        }
Exemplo n.º 2
0
 public static void SaveGame(Game game)
 {
     using (var db = CreateDB())
     {
         db.ExecuteWithParams("update game set Status = @Status, Serialized = @Serialized, Private = @Private where id = @Id", new { Id = game.Id, Status = game.Status, Serialized = game.Save(), @Private = (game.IsPrivate ? 1 : 0) });
     }
 }