public string test(string para01, string para02) { string id = para01; string income_id = para02; SUPPORT sUPPORT = db.SUPPORT.Find(id, income_id); if (sUPPORT != null) { return("1"); } SPONSOR myid = db.SPONSOR.Find(id); if (myid == null) { return("2"); } INCOME myincome_id = db.INCOME.Find(income_id); if (myincome_id == null) { return("3"); } return("4"); }
public JsonResult Edit(string para01, string para02, string para03) { string id = para01; string name = para02; string number = para03; SPONSOR sPONSOR = db.SPONSOR.Find(id); sPONSOR.SPONSOR_ID = id; sPONSOR.SPONSOR_NAME = name; sPONSOR.PHONE_NUMBER = number; db.Entry(sPONSOR).State = EntityState.Modified; try { db.SaveChanges(); } catch (Exception ex) { throw; } var list = db.SPONSOR.Select(n => new { SPONSOR_ID = n.SPONSOR_ID, SPONSOR_NAME = n.SPONSOR_NAME, PHONE_NUMBER = n.PHONE_NUMBER }); return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteConfirmed(string id) { SPONSOR sPONSOR = db.SPONSOR.Find(id); db.SPONSOR.Remove(sPONSOR); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SPONSOR_ID,SPONSOR_NAME,PHONE_NUMBER")] SPONSOR sPONSOR) { if (ModelState.IsValid) { db.Entry(sPONSOR).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sPONSOR)); }
public ActionResult Create([Bind(Include = "SPONSOR_ID,SPONSOR_NAME,PHONE_NUMBER")] SPONSOR sPONSOR) { if (ModelState.IsValid) { db.SPONSOR.Add(sPONSOR); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sPONSOR)); }
public ActionResult Edit([Bind(Include = "ID_SPONSOR,ID_PROYEK,ID_PENGGUNA,JUMLAH_SPONSOR,ID_BANK,CREATE_BY,CREATE_DATE,UPDATE_BY,UPDATE_DATE,ANONIM,KETERANGAN,STATUS")] SPONSOR sPONSOR) { if (ModelState.IsValid) { db.Entry(sPONSOR).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_PENGGUNA = new SelectList(db.PENGGUNA, "ID_PENGGUNA", "NAMA", sPONSOR.ID_PENGGUNA); ViewBag.ID_PROYEK = new SelectList(db.PROJEK, "ID_PROYEK", "NAMA_PROYEK", sPONSOR.ID_PROYEK); return(View(sPONSOR)); }
// GET: SPONSORs/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SPONSOR sPONSOR = db.SPONSOR.Find(id); if (sPONSOR == null) { return(HttpNotFound()); } return(View(sPONSOR)); }
// GET: historiSponsor/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SPONSOR sPONSOR = db.SPONSOR.Find(id); if (sPONSOR == null) { return(HttpNotFound()); } ViewBag.ID_PENGGUNA = new SelectList(db.PENGGUNA, "ID_PENGGUNA", "NAMA", sPONSOR.ID_PENGGUNA); ViewBag.ID_PROYEK = new SelectList(db.PROJEK, "ID_PROYEK", "NAMA_PROYEK", sPONSOR.ID_PROYEK); return(View(sPONSOR)); }
public void Delete(string id) { if (id == null) { return; } SPONSOR sPONSOR = db.SPONSOR.Find(id); if (sPONSOR == null) { return; } db.SPONSOR.Remove(sPONSOR); db.SaveChanges(); }
public JsonResult Create01(string para01, string para02, string para03) { string id = para01; string name = para02; string number = para03; SPONSOR sPONSOR = db.SPONSOR.Find(id); SPONSOR newSponsor = new SPONSOR(); newSponsor.SPONSOR_ID = id; newSponsor.SPONSOR_NAME = name; newSponsor.PHONE_NUMBER = number; if (sPONSOR == null) { db.SPONSOR.Add(newSponsor); db.SaveChanges(); } var list = db.SPONSOR.Select(n => new { SPONSOR_ID = n.SPONSOR_ID, SPONSOR_NAME = n.SPONSOR_NAME, PHONE_NUMBER = n.PHONE_NUMBER }); return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet)); }