public JsonResult CargarColores(int id) { var Colores = from s in db.ColorMat where s.Estado == 1 select s; Colores = Colores.Where(s => s.IdCatMaterial == id); List <ColorMat> listcolor = new List <ColorMat>(); foreach (var item in Colores.ToList()) { ColorMat s = new Models.ColorMat(); s.IdColor = item.IdColor; s.Nombre = item.Nombre; listcolor.Add(s); } return(Json(listcolor.ToList(), JsonRequestBehavior.AllowGet)); }
public JsonResult CargarColores(int id) { var Colores = from s in db.ColorMat where s.Estado == 1 select s; Colores = Colores.Where(s => s.IdCatMaterial == id); List<ColorMat> listcolor = new List<ColorMat>(); foreach (var item in Colores.ToList()) { ColorMat s = new Models.ColorMat(); s.IdColor = item.IdColor; s.Nombre = item.Nombre; listcolor.Add(s); } return Json(listcolor.ToList(), JsonRequestBehavior.AllowGet); }