Ejemplo n.º 1
0
        public virtual async Task <List <CustomerConsumption> > GetPayments(GetCustomerPaymentsModel.Request request)
        {
            List <CustomerConsumption> result;

            using (var mongo = new Data.MongoDB.MongoDB(_connectionStringsSettings.MongoDbChallenge, MONGODB_COLLECTION, MONGODB_DATABASE))
            {
                var res = await mongo.GetMany <CustomerConsumption>(GetFilter(request));

                result = (res).ToList();
            }

            return(result);
        }
        public virtual async Task <Customer> GetData(GetCustomerModel.Request request)
        {
            Customer result = null;

            using (var mongo = new Data.MongoDB.MongoDB(_connectionStringsSettings.MongoDbChallenge, MONGODB_COLLECTION, MONGODB_DATABASE))
            {
                var found = await mongo.GetMany <Customer>(c => c.Cpf.Equals(new Cpf(request.Cpf).Value));

                if (found.HaveAny())
                {
                    result = found.Single();
                }
            }

            return(result);
        }