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); } }
private static void Print() { var c = new AerospikeQueryClient(); foreach (var card in c.GetCardsByUserId(0)) { Console.WriteLine(card.FrontSide); } }
public Quizleç.Models.Card GetCard(int id) { try { using var client = new AerospikeQueryClient(); return(client.GetCard(id)); } catch (DatabaseException e) { throw new GraphQlException(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 Collection DeleteCollection(int id) { try { using var queryClient = new AerospikeQueryClient(); using var writeClient = new AerospikeWriteClient(); var collection = queryClient.GetCollectionInfo(id); writeClient.Delete(Entities.Collection, id); return(collection); } catch (DatabaseException e) { throw new GraphQlException(e.Message); } }
public Card DeleteCard(int id) { try { using var queryClient = new AerospikeQueryClient(); using var writeClient = new AerospikeWriteClient(); var card = queryClient.GetCard(id); writeClient.Delete(Entities.Card, id); return(card); } catch (DatabaseException e) { throw new GraphQlException(e.Message); } }
public User DeleteUser(int id) { try { using var queryClient = new AerospikeQueryClient(); using var writeClient = new AerospikeWriteClient(); var user = queryClient.GetUserInfo(id); writeClient.Delete(Entities.User, id); return(user); } 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); } }
public CollectionWithCards GetCollection(int id) { try { using var client = new AerospikeQueryClient(); var collection = client.GetCollectionInfo(id); var cards = client.GetCardsByCollectionId(id); var res = new CollectionWithCards() { Id = collection.Id, Name = collection.Name, Description = collection.Description, Cards = cards, CardsCount = cards.Count }; return(res); } catch (DatabaseException e) { throw new GraphQlException(e.Message); } }