public async Task Update(Guild guild) { ValidateGuild(guild); try { var filter = new FilterDefinitionBuilder <Guild>().Eq(g => g.Id, guild.Id); var guildOld = await GetById(guild.Id); if (!guildOld.Owner.Equals(guild.Owner)) { throw new Exception("Do not change owner"); } Guild guildUpdated = await _mongoDB.Update(filter, guild); if (guildUpdated == null) { throw new NotFoundException("Guild not found"); } } catch (Exception e) { throw e; } }
public async Task Update(Player player) { ValidatePlayer(player); try { var filter = new FilterDefinitionBuilder <Player>().Eq(p => p.Id, player.Id); Player playerUpdated = await _mongoDB.Update(filter, player); if (playerUpdated == null) { throw new NotFoundException("Player not found"); } } catch (Exception e) { throw e; } }