Add field of decimal type entity framework [closed]

1

I have a Repair table on it, I have ValueObject, ValuePart, and ValueObject all of a decimal type. The field ValueTotal = ValueOfOblock + valuePart. But this is returning 0. I am showing this in the detail view when I click I will see the repair summary with its total price.

My RepairController / details

public ActionResult Detalhes(int id)
{
    decimal total = 0m;

    ConsertoVM model;
    using (Db db = new Db())
    {
        Conserto cons = db.Conserto.Find(id);
        decimal peca = cons.Pecas.ValorUnitatio;
        total += (cons.ValorMaoObra + peca);

        model = new ConsertoVM(cons);
    }

    return View(model);
}
    
asked by anonymous 31.01.2018 / 20:54

0 answers