public ActionResult DeleteConfirmed(int id) { MahasiswaModels mahasiswamodels = db.MahasiswaModels.Find(id); db.MahasiswaModels.Remove(mahasiswamodels); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /Mahasiswa/Details/5 public ActionResult Details(int id = 0) { MahasiswaModels mahasiswamodels = db.MahasiswaModels.Find(id); if (mahasiswamodels == null) { return(HttpNotFound()); } return(View(mahasiswamodels)); }
public ActionResult Edit(MahasiswaModels mahasiswamodels) { if (ModelState.IsValid) { db.Entry(mahasiswamodels).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_fakultas = new SelectList(db.FakultasModels, "ID_fakultas", "Fakultas", mahasiswamodels.ID_fakultas); return(View(mahasiswamodels)); }
// // GET: /Mahasiswa/Edit/5 public ActionResult Edit(int id = 0) { MahasiswaModels mahasiswamodels = db.MahasiswaModels.Find(id); if (mahasiswamodels == null) { return(HttpNotFound()); } ViewBag.ID_fakultas = new SelectList(db.FakultasModels, "ID_fakultas", "Fakultas", mahasiswamodels.ID_fakultas); return(View(mahasiswamodels)); }
public ActionResult Create(MahasiswaModels mahasiswamodels) { if (ModelState.IsValid) { db.MahasiswaModels.Add(mahasiswamodels); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_fakultas = new SelectList(db.FakultasModels, "ID_fakultas", "Fakultas", mahasiswamodels.ID_fakultas); return(View(mahasiswamodels)); }
// // GET: /Mahasiswa/ public ActionResult Index(string searchName, string searchFakultas) { var mahasiswamodels = db.MahasiswaModels.Include(m => m.FakultasModels); var mahasiswa = new MahasiswaModels(); if (!String.IsNullOrEmpty(searchName)) { mahasiswamodels = mahasiswamodels.Where(n => n.nama.Contains(searchName)); } ViewBag.searchFakultas = new SelectList(db.FakultasModels, "Fakultas", "Fakultas", mahasiswa.ID_fakultas); if (!String.IsNullOrEmpty(searchFakultas)) { mahasiswamodels = mahasiswamodels.Where(d => d.FakultasModels.Fakultas == searchFakultas); } return(View(mahasiswamodels.ToList())); }