Exemplo n.º 1
0
        public ActionResult Create(COSTO costo, bool SINO)
        {
            if (ModelState.IsValid)
            {
                if (SINO != false)
                {
                    Variables var = db.Variables.Find(1); //DOLAR ES EL PRIMERO;
                    costo.VALOR = costo.VALOR * var.VALOR;
                    costo.VALOR = Math.Round(costo.VALOR.Value, 1);
                    db.COSTO.Add(costo);
                    db.SaveChanges();
                }
                else
                {
                    db.COSTO.Add(costo);
                    db.SaveChanges();
                }
                return RedirectToAction("Index");
            }

            return View(costo);
        }
Exemplo n.º 2
0
 public ActionResult Edit(COSTO costo, bool SINO)
 {
     if (ModelState.IsValid)
     {
         if (SINO != false)
         {
             Variables var = db.Variables.Find(1); //DOLAR ES EL PRIMERO;
             costo.VALOR = costo.VALOR * var.VALOR;
             costo.VALOR = Math.Round(costo.VALOR.Value, 1);
         }
         db.Entry(costo).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(costo);
 }