public JsonResult BindingParameter(int?type) { var a = db.graphic_parameter.Where(p => p.type == type); List <GraphicParameterSelect> result = new List <GraphicParameterSelect>(); foreach (graphic_parameter lok in a) { GraphicParameterSelect temp = new GraphicParameterSelect { id = lok.id, name = lok.parameter }; result.Add(temp); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(IEnumerable <GraphicDataWrapper> models) { List <GraphicDataWrapper> ss = new List <GraphicDataWrapper>(); foreach (var source in models) { int id = GraphicWrapper.Insert(source); GraphicLokasiSamplingSelect ls = db.lokasi_sampling.Select(p => new GraphicLokasiSamplingSelect { id = p.id, name = p.lokasi_sampling1 }).Where(p => p.id == source.id_lokasi).FirstOrDefault(); GraphicParameterSelect pr = db.graphic_parameter.Select(p => new GraphicParameterSelect { id = p.id, name = p.parameter }).Where(p => p.id == source.id_parameter).FirstOrDefault(); // store the product in the result ss.Add(new GraphicDataWrapper { id = id, lokasi_sampling = ls, id_lokasi = source.id_lokasi, id_parameter = source.id_parameter, date = source.date, hasil_analisis = source.hasil_analisis }); } return(Json(ss.ToList())); }