public IActionResult UpdateTimb([Bind("id,code,id_controller,type_controller,ip_controller,id_printer,type_printer,ip_printer,path,id_dig_scale,barang,lot_no,counter,tare,kemasan,type_dig_scale,location")] Setting item) { item.code = "SC"; if (ModelState.IsValid) { db.Update(item); db.SaveChanges(); return(RedirectToAction("Timb")); } return(View()); }
public JsonResult Update([FromBody][Bind("id,code,id_controller,type_controller,ip_controller,barang,lot_no,counter,tare,kemasan,location,id_printer,type_printer,ip_printer,path,id_dig_scale,type_dig_scale")] dynamic data) { bool save = false; //data.code = "CR"; List <Setting> items = data.ToObject <List <Setting> >(); foreach (Setting item in items) { item.code = "CR"; if (ModelState.IsValid) { db.Update(item); db.SaveChanges(); save = true; } } return(Json(save)); }