private static void HardcodeGet() { AerospikeQueryClient c = new AerospikeQueryClient(); try { Console.WriteLine(c.GetUserInfo(1).Login); } catch (Exception e) { Console.WriteLine(e.Message); } try { Console.WriteLine(c.GetCollectionsByUserId(1).Count); } catch (Exception e) { Console.WriteLine(e.Message); } try { Console.WriteLine(c.GetCardsByUserId(1)[0].FrontSide); } catch (Exception e) { Console.WriteLine(e.Message); } }
public List <Quizleç.Models.Collection> GetCollectionsByUserId(int id) { try { using var client = new AerospikeQueryClient(); return(client.GetCollectionsByUserId(id)); } catch (DatabaseException e) { throw new GraphQlException(e.Message); } }
public UserWithCollections GetUser(int id) { try { using var client = new AerospikeQueryClient(); var user = client.GetUserInfo(id); var collections = client.GetCollectionsByUserId(id); var res = new UserWithCollections() { Id = user.Id, Login = user.Login, Email = user.Email, Collections = collections, CollectionsCount = collections.Count }; return(res); } catch (DatabaseException e) { throw new GraphQlException(e.Message); } }