// GET: CurriculumEntryYear/Details/5
        public ActionResult Details(short?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Acd_Curriculum_Entry_Year acd_Curriculum_Entry_Year = db.Acd_Curriculum_Entry_Year.Find(id);

            if (acd_Curriculum_Entry_Year == null)
            {
                return(HttpNotFound());
            }
            return(View(acd_Curriculum_Entry_Year));
        }
 public ActionResult Edit([Bind(Include = "Curriculum_Entry_Year_Id,Term_Year_Id,Department_Id,Class_Prog_Id,Entry_Year_Id,Curriculum_Id,Created_By,Created_Date,Modified_By,Modified_Date,Order_Id")] Acd_Curriculum_Entry_Year acd_Curriculum_Entry_Year, string UrlReferrer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(acd_Curriculum_Entry_Year).State = EntityState.Modified;
         db.SaveChanges();
         return(Redirect(UrlReferrer));
     }
     ViewBag.Curriculums = db.Mstr_Curriculum_Applied.Where(ca => ca.Department_Id == acd_Curriculum_Entry_Year.Department_Id).ToList();
     ViewBag.EntryYears  = db.Mstr_Entry_Year.Where(ey => ey.Entry_Year_Id == acd_Curriculum_Entry_Year.Entry_Year_Id).First();
     ViewBag.ClassProgs  = db.Mstr_Class_Program.Where(cp => cp.Class_Prog_Id == acd_Curriculum_Entry_Year.Class_Prog_Id).First();
     ViewBag.Term_Year   = db.Mstr_Term_Year.Where(ty => ty.Term_Year_Id == acd_Curriculum_Entry_Year.Term_Year_Id).First();
     ViewBag.Department  = db.Mstr_Department.Where(d => d.Department_Id == acd_Curriculum_Entry_Year.Department_Id).First();
     ViewBag.UrlReferrer = UrlReferrer;
     return(View(acd_Curriculum_Entry_Year));
 }
        public ActionResult Create([Bind(Include = "Curriculum_Entry_Year_Id,Term_Year_Id,Department_Id,Class_Prog_Id,Entry_Year_Id,Curriculum_Id,Created_By,Created_Date,Modified_By,Modified_Date,Order_Id")] Acd_Curriculum_Entry_Year acd_Curriculum_Entry_Year, string UrlReferrer)
        {
            if (ModelState.IsValid)
            {
                db.Acd_Curriculum_Entry_Year.Add(acd_Curriculum_Entry_Year);
                db.SaveChanges();
                return(Redirect(UrlReferrer));
            }

            //ViewBag.Class_Prog_Id = new SelectList(db.Mstr_Class_Program, "Class_Prog_Id", "Class_Prog_Code", acd_Curriculum_Entry_Year.Class_Prog_Id);
            //ViewBag.Curriculum_Id = new SelectList(db.Mstr_Curriculum, "Curriculum_Id", "Curriculum_Code", acd_Curriculum_Entry_Year.Curriculum_Id);
            //ViewBag.Department_Id = new SelectList(db.Mstr_Department, "Department_Id", "Department_Code", acd_Curriculum_Entry_Year.Department_Id);
            //ViewBag.Entry_Year_Id = new SelectList(db.Mstr_Entry_Year, "Entry_Year_Id", "Entry_Year_Name", acd_Curriculum_Entry_Year.Entry_Year_Id);
            //ViewBag.Term_Year_Id = new SelectList(db.Mstr_Term_Year, "Term_Year_Id", "Term_Year_Name", acd_Curriculum_Entry_Year.Term_Year_Id);
            return(View(acd_Curriculum_Entry_Year));
        }
        // GET: CurriculumEntryYear/Delete/5
        //public ActionResult Delete(short? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    Acd_Curriculum_Entry_Year acd_Curriculum_Entry_Year = db.Acd_Curriculum_Entry_Year.Find(id);
        //    if (acd_Curriculum_Entry_Year == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(acd_Curriculum_Entry_Year);
        //}

        // POST: CurriculumEntryYear/Delete/5
        //[HttpPost, ActionName("Delete")]
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(short id)
        {
            string UrlReferrer = System.Web.HttpContext.Current.Request.UrlReferrer.ToString();
            Acd_Curriculum_Entry_Year acd_Curriculum_Entry_Year = db.Acd_Curriculum_Entry_Year.Find(id);

            db.Acd_Curriculum_Entry_Year.Remove(acd_Curriculum_Entry_Year);
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                TempData["gagalHapus"] = "Gagal Hapus, Data sudah digunakan";
                return(Redirect(UrlReferrer));
            }
            TempData["berhasilHapus"] = "Berhasil Hapus Data.";
            return(Redirect(UrlReferrer));
        }
        // GET: CurriculumEntryYear/Edit/5
        public ActionResult Edit(short?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Acd_Curriculum_Entry_Year acd_Curriculum_Entry_Year = db.Acd_Curriculum_Entry_Year.Find(id);

            if (acd_Curriculum_Entry_Year == null)
            {
                return(HttpNotFound());
            }
            var curriculumApplaed = db.Mstr_Curriculum_Applied.Where(ca => ca.Department_Id == acd_Curriculum_Entry_Year.Department_Id).Select(ca => ca.Curriculum_Id).ToList();

            ViewBag.Curriculums = db.Mstr_Curriculum.Where(c => curriculumApplaed.Contains(c.Curriculum_Id)).ToList();
            ViewBag.EntryYears  = db.Mstr_Entry_Year.Where(ey => ey.Entry_Year_Id == acd_Curriculum_Entry_Year.Entry_Year_Id).First();
            ViewBag.ClassProgs  = db.Mstr_Class_Program.Where(cp => cp.Class_Prog_Id == acd_Curriculum_Entry_Year.Class_Prog_Id).First();
            ViewBag.Term_Year   = db.Mstr_Term_Year.Where(ty => ty.Term_Year_Id == acd_Curriculum_Entry_Year.Term_Year_Id).First();
            ViewBag.Department  = db.Mstr_Department.Where(d => d.Department_Id == acd_Curriculum_Entry_Year.Department_Id).First();
            ViewBag.UrlReferrer = System.Web.HttpContext.Current.Request.UrlReferrer.ToString();

            return(View(acd_Curriculum_Entry_Year));
        }