Exemplo n.º 1
0
        // GET: ogrenci_notlar/Delete/5
        public ActionResult Delete(int?id)
        {
            if (Convert.ToInt32(Session["kulTip"]) == 1 && !String.IsNullOrEmpty(Session["kulId"].ToString()))
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                ogrenci_not ogrenci_not = db.ogrenciNotlar.Find(id);
                if (ogrenci_not == null)
                {
                    return(HttpNotFound());
                }
                ogrenci_not.silindiMi       = true;
                db.Entry(ogrenci_not).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "ogrenci_notlar"));
            }

            else
            {
                return(RedirectToAction("index", "giris"));
            }
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "id,not,ders_id,ogrenci_id,silindiMi")] ogrenci_not ogrenci_not)
        {
            if (Convert.ToInt32(Session["kulTip"]) == 1 && !String.IsNullOrEmpty(Session["kulId"].ToString()))
            {
                if (ModelState.IsValid)
                {
                    ogrenci_not.donem_id = db.donemler.FirstOrDefault(d => d.baslangicTarihi <= DateTime.Now && d.bitisTarihi > DateTime.Now).id;
                    db.ogrenciNotlar.Add(ogrenci_not);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }


                ViewBag.ders_id = new SelectList(db.dersler, "id", "isim", ogrenci_not.ders_id);


                ViewBag.ogrenci_id = new SelectList(db.ogrenciler, "id", "adSoyad", ogrenci_not.ogrenci_id);
                return(View(ogrenci_not));
            }

            else
            {
                return(RedirectToAction("index", "giris"));
            }
        }
Exemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "id,not,ders_id,donem_id,ogrenci_id,silindiMi")] ogrenci_not ogrenci_not)
        {
            if (Convert.ToInt32(Session["kulTip"]) == 1 && Session["kulId"] != null || Convert.ToInt32(Session["kulTip"]) == 2 && Session["kulId"] != null)
            {
                if (ModelState.IsValid)
                {
                    db.Entry(ogrenci_not).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("index", "ogrenci_notlar"));
                }
                ViewBag.ders_id    = new SelectList(db.dersler, "id", "isim", ogrenci_not.ders_id);
                ViewBag.ogrenci_id = new SelectList(db.ogrenciler, "id", "adSoyad", ogrenci_not.ogrenci_id);
                return(View(ogrenci_not));
            }

            else
            {
                return(RedirectToAction("index", "giris"));
            }
        }
Exemplo n.º 4
0
        // GET: ogrenci_notlar/Details/5
        public ActionResult Details(int?id)
        {
            if (Convert.ToInt32(Session["kulTip"]) == 1 && !String.IsNullOrEmpty(Session["kulId"].ToString()))
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                ogrenci_not ogrenci_not = db.ogrenciNotlar.Find(id);
                if (ogrenci_not == null)
                {
                    return(HttpNotFound());
                }
                return(View(ogrenci_not));
            }

            else
            {
                return(RedirectToAction("index", "giris"));
            }
        }
Exemplo n.º 5
0
        // GET: ogrenci_notlar/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Convert.ToInt32(Session["kulTip"]) == 1 && Session["kulId"] != null || Convert.ToInt32(Session["kulTip"]) == 2 && Session["kulId"] != null)
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                ogrenci_not ogrenci_not = db.ogrenciNotlar.Find(id);
                if (ogrenci_not == null)
                {
                    return(HttpNotFound());
                }
                ViewBag.ders_id    = new SelectList(db.dersler.Where(d => d.silindiMi == false), "id", "isim", ogrenci_not.ders_id);
                ViewBag.ogrenci_id = new SelectList(db.ogrenciler.Where(o => o.silindiMi == false && o.devamDurumu == true), "id", "adSoyad", ogrenci_not.ogrenci_id);
                return(View(ogrenci_not));
            }

            else
            {
                return(RedirectToAction("index", "giris"));
            }
        }
Exemplo n.º 6
0
 public ActionResult OgrenciDetay()
 {
     if (Convert.ToInt32(Session["kulTip"]) == 4 && !String.IsNullOrEmpty(Session["kulId"].ToString()))
     {
         var ogrenciList = new List <ogrenci>();
         var notlarList  = new List <ogrenci_not>();
         int veliId      = Convert.ToInt32(db.kullanicilar.Find(Convert.ToInt32(Session["kulId"])).veli_id);
         ogrenciList = db.ogrenciler.Where(o => o.veli_id == veliId && o.silindiMi == false).ToList();
         foreach (var item in ogrenciList)
         {
             foreach (var item2 in item.ogrenciNotlar)
             {
                 ogrenci_not on = new ogrenci_not();
                 on = item2;
                 notlarList.Add(on);
             }
         }
         return(View(notlarList.Where(on => on.silindiMi == false)));
     }
     else
     {
         return(RedirectToAction("index", "giris"));
     }
 }