示例#1
0
        public VarlikResult <List <CommisionDto> > GetAllCommission()
        {
            var result = new VarlikResult <List <CommisionDto> >();

            using (var ctx = new VarlikContext())
            {
                var fromEntity = new CommisionDto().FromEntity().Expand();
                result.Data = ctx.Commission
                              .AsExpandable()
                              .Select(fromEntity)
                              .ToList();
                result.Success();
            }

            return(result);
        }
示例#2
0
        public VarlikResult <CommisionDto> GetCommission(string idCoinType, decimal transactionVolume)
        {
            var result = new VarlikResult <CommisionDto>();

            using (var ctx = new VarlikContext())
            {
                var fromEntity = new CommisionDto().FromEntity().Expand();
                result.Data = ctx.Commission
                              .AsExpandable()
                              .Where(l => l.IdCoinType == idCoinType && l.TransactionVolume <= (decimal)transactionVolume)
                              .OrderByDescending(l => l.TransactionVolume)
                              .Select(fromEntity)
                              .OrderByDescending(l => l.TransactionVolume)
                              .FirstOrDefault();
                result.Success();
            }
            return(result);
        }