protected ViewResult bindingTableRuang() { var listResultTemp = (from table in db.ruangs select table).ToList(); List<ruang> listResult = new List<ruang>(); foreach (var item in listResultTemp) { ruang newRuang = new ruang(); newRuang.id = item.id; newRuang.nama_ruang = item.nama_ruang; listResult.Add(newRuang); } return View(new GridModel<ruang> { Data = listResult }); }
public ActionResult _InsertRuang() { ruang ruang = new ruang(); if (TryUpdateModel(ruang)) { db.ruangs.Add(ruang); db.SaveChanges(); } return bindingTableRuang(); }