It’s not overwriting the value

Asked

Viewed 88 times

2

I’m wanting the final calculation information to overwrite what is already saved in the Stock table, as it would be to do this, because Save, is overwriting correctly, I tried to apply in the update, but not saved.

Update:

var ConsultaAntigo = ckm.Compra(viewModel.Id);
var Antigo = ConsultaAntigo.OrderBy(c => c.NomeProduto).FirstOrDefault();
var Consulta = ckm.ControleEstoque(viewModel.ProdutoId);
var estoque = Consulta.OrderBy(t => t.NomeProduto).FirstOrDefault();    
int AntigoFinal = estoque.Quantidade - Antigo.Quant;    
int quantidadefinal = AntigoFinal + viewModel.Quant;    
estoque.Quantidade = quantidadefinal;

DAO Compra:

public void Update(Compra compra)
{
    using (ISession session = NHibernateHelper.AbreSession())
    {
        ITransaction tx = session.BeginTransaction();
        session.Update(compra);
        tx.Commit();
    }
}
  • you are running the SaveChanges()?

  • On DAO, you are running Update

  • I asked the question how DAO works, @Leandroangelo

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.