public ActionResult Edit(int id) { ViewBag.SupplierList = new SelectList(SupplierRepo.GetAll(), "Id", "Nama"); BarangViewModel model = BarangRepo.GetById(id); return(PartialView(model)); }
//public ActionResult SaveDeleteBarang(BarangModel terserah) //{ // Session["ID"] = "1"; // BarangRepo barangRepo = new BarangRepo(); // terserah.CreatedBy = this.Session["ID"].ToString(); // terserah.CreatedDate = DateTime.Now; // terserah.UpdatedDate = DateTime.Now; // if (barangRepo.SaveEdit(terserah)) // { // return Json(new { status = "Berhasil" }, JsonRequestBehavior.AllowGet); // } // else // { // return Json(new { status = "Gagal" }, JsonRequestBehavior.AllowGet); // } // return View(); //} public ActionResult GetAll() { BarangRepo barangRepo = new BarangRepo(); List <BarangModel> barangModel = barangRepo.GetAll(); return(Json(barangModel, JsonRequestBehavior.AllowGet)); }
public List <BarangModel> GetAll() { BarangRepo barangRepo = new BarangRepo(); List <BarangModel> result = barangRepo.GetAll(); return(result); }
public ActionResult EditSimpan(Barang barang) { if (BarangRepo.Editbarang(barang)) { return(Json(new { EditSimpan = "Berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { EditSimpan = "Gagal" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditSimpan(Barang barang) { if (BarangRepo.Editbarang(barang)) { return(Json(new { EditSimpan = "Berhasil" }, JsonRequestBehavior.AllowGet)); //return json digunakan untuk memunculkan alert } else { return(Json(new { EditSimpan = "Gagal" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Delete(int ID) { if (BarangRepo.Deletebarang(ID)) //non static if ( barangRepo.Deletebarang(ID)) { return(Json(new { Hapus = "Berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { Hapus = "Gagal" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult DeleteConfirm(int id) { if (BarangRepo.DeleteById(id)) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = BarangRepo.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Save(Barang barang) { if (BarangRepo.Createbarang(barang)) { return(Json(new { Simpan = "Berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { Simpan = "Gagal" }, JsonRequestBehavior.AllowGet)); } return(View()); }
public ActionResult SaveItem(BarangModel inputBarang) { BarangRepo saveData = new BarangRepo(); inputBarang.createdBy = Session["name"].ToString(); inputBarang.created = DateTime.Now; if (saveData.Save(inputBarang)) { return(Json(new { status = "berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = "gagal" }, JsonRequestBehavior.AllowGet)); } return(View()); }
public ActionResult SaveEdit(BarangModel editConfirm) { BarangRepo saveEdit = new BarangRepo(); editConfirm.updateByDate = DateTime.Now; editConfirm.updatedBy = Session["name"].ToString(); if (saveEdit.SaveEdit(editConfirm)) { return(Json(new { status = "berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = "gagal" }, JsonRequestBehavior.AllowGet)); } return(View()); }
public ActionResult SaveBarang(BarangModel paimin) { Session["ID"] = "1"; //menggunakan return JSON BarangRepo barangRepo = new BarangRepo(); paimin.CreatedBy = this.Session["ID"].ToString(); paimin.CreatedDate = DateTime.Now; if (barangRepo.Save(paimin)) { return(Json(new { status = "Berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = "Gagal" }, JsonRequestBehavior.AllowGet)); } return(View()); }
public ActionResult Edit(BarangViewModel model) { if (ModelState.IsValid) { if (BarangRepo.Update(model)) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = BarangRepo.Message }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { success = false, message = "Invalid" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult SaveEditBarang(BarangModel terserah) { Session["ID"] = "1"; BarangRepo barangRepo = new BarangRepo(); terserah.CreatedBy = this.Session["ID"].ToString(); terserah.CreatedDate = DateTime.Now; terserah.UpdatedDate = DateTime.Now; //barangRepo.SaveEdit(terserah); if (barangRepo.SaveEdit(terserah)) { return(Json(new { status = "Berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = "Gagal" }, JsonRequestBehavior.AllowGet)); } //return View(); }
// // GET: /Barang/ public ActionResult Index() { return(View(BarangRepo.GetAll())); }
public ActionResult Tampil() { return(Json(BarangRepo.GetAll(), JsonRequestBehavior.AllowGet)); }
public ActionResult Delete(int id) { return(PartialView(BarangRepo.GetById(id))); }
public ActionResult ListWithSelect() { return(PartialView(BarangRepo.GetAll())); }
public ActionResult ListWithSelectSupplier(int IdSupplier) { return(PartialView(BarangRepo.GetAll(IdSupplier))); }
public ActionResult Edit(int ID) { return(PartialView("_Edit", BarangRepo.GetByID(ID))); }
public List <Barang> GetAll() { return(BarangRepo.GetAll()); }
public ActionResult AmbilData(int ID) { return(Json(BarangRepo.GetByID(ID), JsonRequestBehavior.AllowGet)); }