public async Task <Guild> GetById(string id) { if (string.IsNullOrEmpty(id)) { throw new ParameterException("ID is null"); } try { var filter = new FilterDefinitionBuilder <Guild>().Eq(g => g.Id, id); Guild guild = await _mongoDB.GetByFilter(filter); if (guild == null) { throw new NotFoundException("Guild not found"); } return(guild); } catch (NotFoundException ne) { throw ne; } catch (Exception e) { throw e; } }
public async Task <Message> GetById(string id) { if (string.IsNullOrEmpty(id)) { throw new ParameterException("Message ID is null"); } try { var filter = new FilterDefinitionBuilder <Message>().Eq(m => m.Id, id); Message message = await _mongoDB.GetByFilter(filter); if (message == null) { throw new NotFoundException("Message nor found"); } return(message); } catch (NotFoundException ne) { throw ne; } catch (Exception e) { throw e; } }
public async Task <Player> GetById(string id) { if (string.IsNullOrEmpty(id)) { throw new ParameterException("ID is null"); } try { var filter = new FilterDefinitionBuilder <Player>().Eq(p => p.Id, id); Player player = await _mongoDB.GetByFilter(filter); if (player == null) { throw new NotFoundException("Player not found"); } return(player); } catch (NotFoundException ne) { throw ne; } catch (Exception e) { throw e; } }