Example #1
0
        public async Task <Message> Save(Message message)
        {
            message.Id     = Guid.NewGuid().ToString();
            message.SendAt = DateTime.UtcNow;
            ValidateMessage(message);
            try
            {
                await _mongoDB.Save(message);

                return(message);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #2
0
        public async Task <Player> Save(Player player)
        {
            player.Id        = Guid.NewGuid().ToString();
            player.CreatedAt = DateTime.UtcNow;
            ValidatePlayer(player);
            try
            {
                await _mongoDB.Save(player);

                return(player);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #3
0
        public async Task <Guild> Save(Guild guild)
        {
            guild.Id        = Guid.NewGuid().ToString();
            guild.CreatedAt = DateTime.UtcNow;
            guild.Players   = new List <string> {
                guild.Owner
            };
            ValidateGuild(guild);
            try
            {
                await _mongoDB.Save(guild);

                return(guild);
            }
            catch (Exception e)
            {
                throw e;
            }
        }