Esempio n. 1
0
        public async Task <User_Model> SignUpAsync(User_SignUp_Schema model)
        {
            var user       = new User_Model();
            var parameters = _parameterHandler.MakeParameters(model);
            var result     = await _repository.QueryMultipleAsync(model.GetSchemaName(), param : parameters, commandType : CommandType.StoredProcedure);

            if (!result.IsConsumed)
            {
                user = await result.ReadFirstOrDefaultAsync <User_Model>();
            }
            if (!result.IsConsumed)
            {
                user.Customer = await result.ReadFirstOrDefaultAsync <Customer_Model>();
            }
            if (!result.IsConsumed)
            {
                var properties = await result.ReadAsync <UserProperty_Model>();

                if (properties.Any())
                {
                    user.Properties = properties.ToList();
                }
            }
            _parameterHandler.SetOutputValues(model, parameters);
            _parameterHandler.SetReturnValue(model, parameters);
            return(user);
        }
Esempio n. 2
0
        public void ExecuteReturnLess(Schema model)
        {
            var parameters = _parameterHandler.MakeParameters();

            _repository.Execute(model.GetSchemaName(), parameters, commandType: CommandType.StoredProcedure);
            _parameterHandler.SetOutputValues(parameters);
            _parameterHandler.SetReturnValue(parameters);
        }
        public void Execute <Schema>(Schema model)
            where Schema : IStoredProcSchema
        {
            var parameters = _parameterHandler.MakeParameters(model);

            _dbconn.Execute(model.GetStoredProcedureName(), parameters, commandType: CommandType.StoredProcedure);
            _parameterHandler.SetOutputValues(model, parameters);
            _parameterHandler.SetReturnValue(model, parameters);
        }
Esempio n. 4
0
        public async Task <Product_Model> GetAsync(Product_Get_Schema model)
        {
            var product    = new Product_Model();
            var parameters = _parameterHandler.MakeParameters(model);
            var result     = await _repository.QueryMultipleAsync(model.GetSchemaName(), param : parameters, commandType : CommandType.StoredProcedure);

            if (!result.IsConsumed)
            {
                product = await result.ReadFirstOrDefaultAsync <Product_Model>();
            }
            if (!result.IsConsumed)
            {
                var images = await result.ReadAsync <Image_Model>();

                if (images.Any())
                {
                    product.Images = images.ToList();
                }
            }
            _parameterHandler.SetOutputValues(model, parameters);
            _parameterHandler.SetReturnValue(model, parameters);
            return(product);
        }