public ActionResult Create([Bind(Include = "id,masinhvien,monhoc,dieml1,dieml2,dieml3,dieml4,kq")] Diemsinhvien diemsinhvien, string m, int s1, int s21, int s22, int t) { if (ModelState.IsValid) { diemsinhvien.dieml1 = s1; diemsinhvien.dieml2 = s21; diemsinhvien.dieml3 = s22; diemsinhvien.dieml4 = t; double D = double.Parse((((diemsinhvien.dieml1 + diemsinhvien.dieml2 + diemsinhvien.dieml3) * 0.3) + (diemsinhvien.dieml4 * 0.6)).ToString()); if (D > 5) { diemsinhvien.kq = "Đậu"; } else { diemsinhvien.kq = "F"; } diemsinhvien.masinhvien = m; db.Diemsinhvien.Add(diemsinhvien); db.SaveChanges(); return(RedirectToAction("get_detaildiem", "Sinhviens", new { id = m })); } ViewBag.masinhvien = new SelectList(db.Sinhvien, "masinhvien", "manganh", diemsinhvien.masinhvien); return(View(diemsinhvien)); }
public ActionResult DeleteConfirmed(int id) { Diemsinhvien diemsinhvien = db.Diemsinhvien.Find(id); db.Diemsinhvien.Remove(diemsinhvien); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: admin/Diemsinhviens/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Diemsinhvien diemsinhvien = db.Diemsinhvien.Find(id); if (diemsinhvien == null) { return(HttpNotFound()); } return(View(diemsinhvien)); }
// GET: admin/Diemsinhviens/Edit/5 public ActionResult Edit(int?id, string ma, int s1, int s21, int s22, int t) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Diemsinhvien diemsinhvien = db.Diemsinhvien.Find(id); if (diemsinhvien == null) { return(HttpNotFound()); } ViewBag.id = ma; ViewBag.d1 = s1; ViewBag.d21 = s21; ViewBag.d22 = s22; ViewBag.dt = t; ViewBag.masinhvien = new SelectList(db.Sinhvien, "masinhvien", "manganh", diemsinhvien.masinhvien); return(View(diemsinhvien)); }