// GET: Home/Details/5 public ActionResult Save(int id) { using (MDKAReservasiEntities db = new MDKAReservasiEntities()) { var v = db.tblT_Reservasi.Where(x => x.Reservasi_PK == id).FirstOrDefault(); return(View(v)); } }
public ActionResult GetReservation() { using (MDKAReservasiEntities db = new MDKAReservasiEntities()) { var employees = db.tblT_Reservasi.OrderBy(x => x.TanggalReservasi).ToList(); return(Json(new { data = employees }, JsonRequestBehavior.AllowGet)); } }
// GET: Home/Delete/5 public ActionResult Delete(int id) { using (MDKAReservasiEntities db = new MDKAReservasiEntities()) { var v = db.tblT_Reservasi.FirstOrDefault(x => x.Reservasi_PK == id); if (v != null) { return(View(v)); } else { return(HttpNotFound()); } } }
public ActionResult Save(tblT_Reservasi emp) { try { // TODO: Add insert logic here using (MDKAReservasiEntities db = new MDKAReservasiEntities()) { if (emp.Reservasi_PK > 0) { var v = db.tblT_Reservasi.Where(x => x.Reservasi_PK == emp.Reservasi_PK).FirstOrDefault(); if (v != null) { v.Ruangan_FK = emp.Ruangan_FK; v.SubjectReservasi = emp.SubjectReservasi; v.TanggalReservasi = emp.TanggalReservasi; v.JamMulai = emp.JamMulai; v.JamSelesai = emp.JamSelesai; } } else { db.tblT_Reservasi.Add(emp); } db.SaveChanges(); status = true; } return(new JsonResult { Data = new { status = status } }); } catch { return(View()); } }
public ActionResult DeleteEmployee(int id) { try { bool status = false; using (MDKAReservasiEntities dc = new MDKAReservasiEntities()) { var v = dc.tblT_Reservasi.Where(a => a.Reservasi_PK == id).FirstOrDefault(); if (v != null) { dc.tblT_Reservasi.Remove(v); dc.SaveChanges(); status = true; } } return(new JsonResult { Data = new { status = status } }); } catch { return(View()); } }