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); }
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); }