public ActionResult DeleteConfirmed(decimal kid, string gvid, DateTime tn) { GiangVienThuocKhoa giangVienThuocKhoa = db.GiangVienThuocKhoas.Find(kid, gvid, tn); db.GiangVienThuocKhoas.Remove(giangVienThuocKhoa); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Khoa.TenKhoa,GiangVien.HoTen,TuNgay,DenNgay,KhoaId,GiangVienId")] GiangVienThuocKhoa giangVienThuocKhoa) { if (ModelState.IsValid) { db.Entry(giangVienThuocKhoa).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GiangVienId = new SelectList(db.GiangViens, "GiangVienId", "HoTen", giangVienThuocKhoa.GiangVienId); ViewBag.KhoaId = new SelectList(db.Khoas, "KhoaId", "TenKhoa", giangVienThuocKhoa.KhoaId); return(View(giangVienThuocKhoa)); }
// GET: GiangVienThuocKhoa/Details/5 public ActionResult Details(decimal id) { if (!UserManager.Authenticated) { return(RedirectToAction("Login", "Admin")); } else { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GiangVienThuocKhoa giangVienThuocKhoa = db.GiangVienThuocKhoas.Find(id); if (giangVienThuocKhoa == null) { return(HttpNotFound()); } return(View(giangVienThuocKhoa)); } }
// GET: GiangVienThuocKhoa/Delete/5 public ActionResult Delete(decimal kid, string gvid, DateTime tn) { if (!UserManager.Authenticated) { return(RedirectToAction("Login", "Admin")); } else { if (kid == 0 && gvid == null && tn == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GiangVienThuocKhoa giangVienThuocKhoa = db.GiangVienThuocKhoas.Find(kid, gvid, tn); if (giangVienThuocKhoa == null) { return(HttpNotFound()); } return(View(giangVienThuocKhoa)); } }
// GET: GiangVienThuocKhoa/Edit/5 public ActionResult Edit(decimal kid, string gvid, DateTime tn) { if (!UserManager.Authenticated) { return(RedirectToAction("Login", "Admin")); } else { if (kid == 0 && gvid == null && tn == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GiangVienThuocKhoa giangVienThuocKhoa = db.GiangVienThuocKhoas.Find(kid, gvid, tn); if (giangVienThuocKhoa == null) { return(HttpNotFound()); } ViewBag.GiangVienId = new SelectList(db.GiangViens, "GiangVienId", "HoTen", giangVienThuocKhoa.GiangVienId); ViewBag.KhoaId = new SelectList(db.Khoas, "KhoaId", "TenKhoa", giangVienThuocKhoa.KhoaId); return(View(giangVienThuocKhoa)); } }
public ActionResult Create([Bind(Include = "KhoaId,GiangVienId,TuNgay,DenNgay")] GiangVienThuocKhoa giangVienThuocKhoa) { if (ModelState.IsValid) { var svKh = db.GiangVienThuocKhoas.Where(n => n.KhoaId == giangVienThuocKhoa.KhoaId).ToList(); if (svKh == null) { return(HttpNotFound()); } var kh = db.Khoas.Where(n => n.KhoaId == giangVienThuocKhoa.KhoaId).SingleOrDefault(); if (kh != null) { ViewBag.IdKhoaHoc = kh.KhoaId; ViewBag.TenKhoaHoc = kh.TenKhoa; } db.GiangVienThuocKhoas.Add(giangVienThuocKhoa); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GiangVienId = new SelectList(db.GiangViens, "GiangVienId", "HoTen", giangVienThuocKhoa.GiangVienId); ViewBag.KhoaId = new SelectList(db.Khoas, "KhoaId", "TenKhoa", giangVienThuocKhoa.KhoaId); return(View(giangVienThuocKhoa)); }