// GET: Mahasiswa public ActionResult Index() { Mahasiswa = new MahasiswaService(); var result = Mahasiswa.GetListMahasiswa(); return(View(result)); }
void LoadData() { if (!IsPostBack) { using (MahasiswaService svc = new MahasiswaService()) { var datas = svc.GetAll(); Grid1.DataSource = datas; Grid1.DataBind(); } } }
public ActionResult Edit(MahasiswaModel model) { try { Mahasiswa = new MahasiswaService(); Mahasiswa.UpdateMahasiswa(model); return(Json(new { success = true, message = "Data Update Successfully" }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { success = false, message = "Save data failed" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(MahasiswaModel model) { try { Mahasiswa = new MahasiswaService(); bool IsdataExist = Mahasiswa.IsDataExist(model.NPM); if (IsdataExist) { return(Json(new { success = false, message = "Data already exist" }, JsonRequestBehavior.AllowGet)); } Mahasiswa.SimpanMahasiswa(model); return(Json(new { success = true, message = "Data Saved Successfully" }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { success = false, message = "Data Saved failed" }, JsonRequestBehavior.AllowGet)); } }
// GET: Mahasiswa/Edit/5 public ActionResult Edit(string id) { Mahasiswa = new MahasiswaService(); ViewData["jurusan"] = Mahasiswa.GetJurusan(); return(View(Mahasiswa.GetListMahasiswaById(id))); }
// GET: Mahasiswa/Create public ActionResult Create() { Mahasiswa = new MahasiswaService(); ViewData["jurusan"] = Mahasiswa.GetJurusan(); return(View()); }