public ActionResult Delete(string id, perSiswa per) { try { // TODO: Add delete logic here perSiswa perSiswaDb = new perSiswa(); if (ModelState.IsValid) { if (id == "") { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } perSiswaDb = db.perSiswaCt.Find(id); if (perSiswaDb == null) { return(HttpNotFound()); } db.perSiswaCt.Remove(perSiswaDb); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(perSiswaDb)); } catch { return(View()); } }
// // GET: /perSiswa/Details/5 public ActionResult Details(string id) { if (id == "") { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } perSiswa perSiswaDb = db.perSiswaCt.Find(id); if (perSiswaDb == null) { return(HttpNotFound()); } return(View(perSiswaDb)); }
// // GET: /perSiswa/Edit/5 public ActionResult Edit(String id) { if (id == "") { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } perSiswa perSiswaDb = db.perSiswaCt.Find(id); if (perSiswaDb == null) { return(HttpNotFound()); } dropDownUserName(perSiswaDb.username); return(View(perSiswaDb)); }
// // GET: /rapor/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } perSiswa perSiswaDb = db.perSiswaCt.Find(id); if (perSiswaDb == null) { return(HttpNotFound()); } if (Session["jabatan"] != null) { if (Session["jabatan"].Equals("admin")) { var kelas = from t in db.nilSikapKI1KI2Ct where t.nis == "2602659072" select new { t.kelasCode }; return(View(perSiswaDb)); } else if (Session["jabatan"].Equals("siswa")) { string user = (string)System.Web.HttpContext.Current.Session["user"]; var siswa = from p in db.perSiswaCt where p.username.Contains(user) select p; return(View(perSiswaDb)); } else { return(RedirectToAction("LogOn", "Account")); } } else { return(RedirectToAction("LogOn", "Account")); } }
public ActionResult Create(perSiswa perSiswaDb) { try { // TODO: Add insert logic here if (ModelState.IsValid) { db.perSiswaCt.Add(perSiswaDb); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(perSiswaDb)); } catch { return(View()); } }
public ActionResult Edit(perSiswa perSiswaDb) { try { // TODO: Add update logic here if (ModelState.IsValid) { db.Entry(perSiswaDb).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(perSiswaDb)); } catch { return(View()); } }