Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            trPermintaanBarang trPermintaanBarang = db.trPermintaanBarangs.Find(id);

            db.trPermintaanBarangs.Remove(trPermintaanBarang);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "id_trans,tgl_trans,id_siswa,id_staff,id_barang,status,created_date,created_by,modified_date,modified_by")] trPermintaanBarang trPermintaanBarang)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trPermintaanBarang).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_barang = new SelectList(db.msBarangs, "id_barang", "nama", trPermintaanBarang.id_barang);
     ViewBag.id_siswa  = new SelectList(db.msSiswas, "id_siswa", "nisn", trPermintaanBarang.id_siswa);
     ViewBag.id_staff  = new SelectList(db.msStaffs, "id_staff", "nama_staff", trPermintaanBarang.id_staff);
     return(View(trPermintaanBarang));
 }
Ejemplo n.º 3
0
        // GET: trPermintaanBarangs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            trPermintaanBarang trPermintaanBarang = db.trPermintaanBarangs.Find(id);

            if (trPermintaanBarang == null)
            {
                return(HttpNotFound());
            }
            return(View(trPermintaanBarang));
        }
Ejemplo n.º 4
0
        // GET: trPermintaanBarangs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            trPermintaanBarang trPermintaanBarang = db.trPermintaanBarangs.Find(id);

            if (trPermintaanBarang == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id_barang = new SelectList(db.msBarangs, "id_barang", "nama", trPermintaanBarang.id_barang);
            ViewBag.id_siswa  = new SelectList(db.msSiswas, "id_siswa", "nisn", trPermintaanBarang.id_siswa);
            ViewBag.id_staff  = new SelectList(db.msStaffs, "id_staff", "nama_staff", trPermintaanBarang.id_staff);
            return(View(trPermintaanBarang));
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "id_trans,tgl_trans,id_siswa,id_staff,id_barang,status,created_date,created_by,modified_date,modified_by")] trPermintaanBarang trPermintaanBarang)
        {
            if (ModelState.IsValid)
            {
                trPermintaanBarang.tgl_trans     = DateTime.Now;
                trPermintaanBarang.id_siswa      = Convert.ToInt32(Session["id"]);
                trPermintaanBarang.status        = 1;
                trPermintaanBarang.created_date  = DateTime.Now;
                trPermintaanBarang.created_by    = Session["nama"].ToString();
                trPermintaanBarang.modified_date = DateTime.Now;
                trPermintaanBarang.modified_by   = Session["nama"].ToString();
                db.trPermintaanBarangs.Add(trPermintaanBarang);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.id_barang = new SelectList(db.msBarangs, "id_barang", "nama", trPermintaanBarang.id_barang);
            ViewBag.id_siswa  = new SelectList(db.msSiswas, "id_siswa", "nisn", trPermintaanBarang.id_siswa);
            ViewBag.id_staff  = new SelectList(db.msStaffs, "id_staff", "nama_staff", trPermintaanBarang.id_staff);
            return(View(trPermintaanBarang));
        }