public ActionResult DeleteConfirmed(long id) { t_donatur t_donatur = db.t_donatur.Find(id); db.t_donatur.Remove(t_donatur); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Details(long id = 0) { t_donatur t_donatur = db.t_donatur.Find(id); var reportId = (from table in db.t_donatur where table.donatur_id == id select table.report_id).FirstOrDefault(); var wilayah = (from table in db.t_report where table.report_id == reportId join table2 in db.t_wilayah on table.wil_id equals table2.wil_id select table2.wil_name).FirstOrDefault(); ViewBag.wilayah = wilayah; if (t_donatur == null) { return(HttpNotFound()); } return(View(t_donatur)); }
public ActionResult Edit(long id = 0) { t_donatur t_donatur = db.t_donatur.Find(id); ViewBag.bencana = new SelectList( (from table in db.t_report join table2 in db.t_wilayah on table.wil_id equals table2.wil_id select new { table.report_id, table2.wil_name }).ToList(), "report_id", "wil_name"); if (t_donatur == null) { return(HttpNotFound()); } return(View(t_donatur)); }
public ActionResult Create(t_donatur t_donatur) { if (ModelState.IsValid) { db.t_donatur.Add(t_donatur); db.SaveChanges(); return(RedirectToAction("Index")); } else { ViewBag.bencana = new SelectList( (from table in db.t_report join table2 in db.t_wilayah on table.wil_id equals table2.wil_id select new { table.report_id, table2.wil_name }).ToList(), "report_id", "wil_name"); return(View(t_donatur)); } }