private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            Provider provider;

            provider = new Provider()
            {
                Name = txtFornecedor.Text
            };

            if (_editing == null)
                provider.Id = Database.GetInstance.redisClient.As<Make>().GetNextSequence();
            else
                provider.Id = _editing.Id;

            if (provider.Validate())
            {
                using (var trans = Database.GetInstance.redisClient.CreateTransaction())
                {
                    trans.QueueCommand(r => r.Store<Provider>(provider));

                    trans.Commit();
                }
                ListaFornecedores();
                LimpaCampos();
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            var provider = new Provider()
            {
                Id = Database.GetInstance.redisClient.As<Provider>().GetNextSequence(),
                Name = txtFornecedor.Text
            };

            using (var trans = Database.GetInstance.redisClient.CreateTransaction())
            {
                trans.QueueCommand(r => r.Store<Provider>(provider));

                trans.Commit();
            }
        }
        private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var fabricanteSelecionado = (Provider)dataGrid1.SelectedItem;

            if (fabricanteSelecionado != null)
            {
                txtFornecedor.Text = fabricanteSelecionado.Name;

                _editing = new Provider
                {
                    Id = fabricanteSelecionado.Id,
                    Name = txtFornecedor.Text,
                };
            }
        }
 private void LimpaCampos()
 {
     txtFornecedor.Text = String.Empty;
     _editing = null;
 }