Ejemplo n.º 1
0
        public ActionResult Create(Categoria categoria, bool express)
        {
            tipusu();
            if (ModelState.IsValid)
            {
                db.Categoria.Add(categoria);
                db.SaveChanges();

                SubCategoria sub = new SubCategoria();
                sub.NOMBRE = "OTROS";
                sub.IDCATEGORIA = categoria.ID;
                db.SubCategoria.Add(sub);
                db.SaveChanges();

                if (express == true)
                {
                    return RedirectToAction("Express");
                }
                return RedirectToAction("Index");
            }

            return View(categoria);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Categoria categoria, string colorpickerField1, string colorpickerField2)
 {
     tipusu();
     if (ModelState.IsValid)
     {
         categoria.Color1 = colorpickerField1;
         categoria.Color2 = colorpickerField2;
         db.Entry(categoria).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Express");
     }
     return View(categoria);
 }