public static double?NotHesapla(this HtmlHelper html, NotDb notDb) { int count = 0; double?notOrt = null; if (!IsNull(notDb.Sinav1)) { if (!IsNull(notDb.Sozlu1)) { count++; notOrt = (notDb.Sinav1.Value * SinavKatPuani + notDb.Sozlu1.Value * SozluKatPuani) / 100; if (!IsNull(notDb.Sinav2)) { if (!IsNull(notDb.Sozlu2)) { count++; notOrt += (notDb.Sinav2.Value * SinavKatPuani + notDb.Sozlu2.Value * SozluKatPuani) / 100; if (!IsNull(notDb.Sinav3)) { if (!IsNull(notDb.Sozlu3)) { count++; notOrt += (notDb.Sinav3.Value * SinavKatPuani + notDb.Sozlu3.Value * SozluKatPuani) / 100; } } } } } } return(notOrt.HasValue ? notOrt / count : null); }
public ActionResult OgrenciNotlariniGuncelle(string notId, string dersId) { NotDb not = db.NotDbs.FirstOrDefault(i => i.NotId == notId); var ders = db.DersDbs.FirstOrDefault(i => i.DersId == dersId); if (ders.NotDbs.Count(i => i.NotId == notId) == 0) { return(RedirectToAction("DersListele", "Home")); } return(View(not)); }
public ActionResult SecilenDers(string dersId) { string ogrId = User.Identity.Name; string notId = string.Concat(dersId, ogrId); NotDb not = new NotDb { DersId = dersId, OgrenciNo = ogrId, NotId = notId }; db.NotDbs.Add(not); db.SaveChanges(); return(RedirectToAction("DersSecimi")); }
public ActionResult OgrenciNotlariniGuncelle(NotDb model) { NotOtomasyonuEntities db = new NotOtomasyonuEntities(); var notupdate = db.NotDbs.FirstOrDefault(i => i.NotId == model.NotId); if (notupdate != null) { notupdate.Sinav1 = model.Sinav1; notupdate.Sinav2 = model.Sinav2; notupdate.Sinav3 = model.Sinav3; notupdate.Sozlu1 = model.Sozlu1; notupdate.Sozlu2 = model.Sozlu2; notupdate.Sozlu3 = model.Sozlu3; db.SaveChanges(); } return(RedirectToAction("OgrenciNotlariniGoruntule", new { dersId = notupdate.DersId })); }