public ActionResult Create(ItemConsumo model)
        {
            ViewBag.color = color;
            if (ModelState.IsValid)
            {
                try
                {
                    decimal valor = 0M;
                    Decimal.TryParse(model.Valor.Replace(".", ""), out valor);
                    tb_itens_consumo item = new tb_itens_consumo();
                    item.descricao = model.Descricao;
                    item.valor = valor;
                    db.tb_itens_consumo.Add(item);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
                catch (Exception ex) { }
            }

            //return View(tb_itens_consumo);
            return View(model);
        }
        public ActionResult Edit(ItemConsumo model)
        {
            ViewBag.color = color;
            if (ModelState.IsValid)
            {
                //db.Entry(tb_itens_consumo).State = EntityState.Modified;
                try
                {
                    decimal valor = 0M;
                    Decimal.TryParse(model.Valor.Replace(".", ""), out valor);
                    tb_itens_consumo tb_item_consumo = db.tb_itens_consumo.Find(model.Codigo);
                    tb_item_consumo.descricao = model.Descricao;
                    tb_item_consumo.valor = valor;
                    db.Entry(tb_item_consumo).State = EntityState.Modified;

                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
                catch (Exception ex) { }
            }
            return View(model);
        }
 // GET: ItensConsumo/Create
 public ActionResult Create()
 {
     ViewBag.color = color;
     ItemConsumo model = new ItemConsumo();
     return View(model);
 }
        // GET: ItensConsumo/Edit/5
        public ActionResult Edit(int? id)
        {
            ViewBag.color = color;
            ItemConsumo model = new ItemConsumo();

            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            tb_itens_consumo tb_itens_consumo = db.tb_itens_consumo.Find(id);
            if (tb_itens_consumo == null)
            {
                return HttpNotFound();
            }
            else
            {
                model.Codigo = tb_itens_consumo.codigo;
                model.Descricao = tb_itens_consumo.descricao;
                model.Valor = tb_itens_consumo.valor.ToString();
            }
            return View(model);
        }