public static string AdaptSerialized(GrpcAccountList grpcAccountList)
 {
     try
     {
         var list = Adapt(grpcAccountList);
         return(JsonSerializer.Serialize(list));
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#2
0
 public static GrpcAccountList Present(AccountList accountList)
 {
     try
     {
         var presented = new GrpcAccountList()
         {
             Pagination = PaginationOutPresenter.Present(accountList.Pagination)
         };
         accountList.Data.ForEach(acc => { presented.Accounts.Add(AccountPresenter.Present(acc)); });
         return(presented);
     }
     catch (Exception)
     {
         throw;
     }
 }
        private static AccountList Adapt(GrpcAccountList grpcAccountList)
        {
            try
            {
                var list = new AccountList()
                {
                    Pagination = GrpcPaginationOutAdapter.Adapt(grpcAccountList.Pagination)
                };

                grpcAccountList.Accounts.ToList().ForEach(acc =>
                {
                    list.Accounts.Add(GrpcAccountAdapter.Adapt(acc));
                });

                return(list);
            }
            catch (Exception)
            {
                throw;
            }
        }