public ActionResult AddOrEdit(int id = 0) { if (id == 0) { ViewBag.ArticuloKFCId = new SelectList(CombosHelper.GetMateriales("", true), "ArticuloKFCId", "Descripcion"); return(PartialView(new Regla())); } else { var articuloId = db.Reglas.Where(x => x.ReglaId == id).FirstOrDefault().ArticuloKFCId; ViewBag.ArticuloKFCId = new SelectList(CombosHelper.GetMateriales("", true), "ArticuloKFCId", "Descripcion", articuloId); return(PartialView(db.Reglas.Where(x => x.ReglaId == id).FirstOrDefault())); } }