示例#1
0
        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);
            }
        }
示例#2
0
        private static void Print()
        {
            var c = new AerospikeQueryClient();

            foreach (var card in c.GetCardsByUserId(0))
            {
                Console.WriteLine(card.FrontSide);
            }
        }
示例#3
0
文件: Query.cs 项目: studokim/Quizlec
 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);
     }
 }
示例#4
0
文件: Query.cs 项目: studokim/Quizlec
 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);
     }
 }
示例#5
0
 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);
     }
 }
示例#6
0
 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);
     }
 }
示例#7
0
 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);
     }
 }
示例#8
0
文件: Query.cs 项目: studokim/Quizlec
 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);
     }
 }
示例#9
0
文件: Query.cs 项目: studokim/Quizlec
 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);
     }
 }