コード例 #1
0
        public ActionResult Edit([Bind(Include = "Education_Type_Id,Education_Type_Code,Education_Type_Name,Created_By,Created_Date,Modified_By,Modified_Date")] Mstr_Education_Type mstr_Education_Type)
        {
            if (ModelState.IsValid)
            {
                db.Entry(mstr_Education_Type).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateException)
                {
                    Mstr_Education_Type EducationType = db.Mstr_Education_Type.Find(mstr_Education_Type.Education_Type_Id);
                    if (EducationType == null)
                    {
                        return(HttpNotFound());
                    }
                    TempData["shortMessage"] = "Kode Jenjang Pendidikan telah ada.";
                    return(RedirectToAction("Edit", mstr_Education_Type));

                    throw;
                }
                return(RedirectToAction("Index"));
            }
            return(View(mstr_Education_Type));
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "Education_Type_Id,Education_Type_Code,Education_Type_Name,Created_By,Created_Date,Modified_By,Modified_Date")] Mstr_Education_Type mstr_Education_Type)
        {
            if (ModelState.IsValid)
            {
                db.Mstr_Education_Type.Add(mstr_Education_Type);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(mstr_Education_Type));
        }
コード例 #3
0
        // GET: EducationType/Details/5
        public ActionResult Details(short?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Mstr_Education_Type mstr_Education_Type = db.Mstr_Education_Type.Find(id);

            if (mstr_Education_Type == null)
            {
                return(HttpNotFound());
            }
            return(View(mstr_Education_Type));
        }
コード例 #4
0
        // GET: EducationType/Delete/5
        //public ActionResult Delete(short? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    Mstr_Education_Type mstr_Education_Type = db.Mstr_Education_Type.Find(id);
        //    if (mstr_Education_Type == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(mstr_Education_Type);
        //}

        // POST: EducationType/Delete/5
        //[HttpPost, ActionName("Delete")]
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(short id)
        {
            Mstr_Education_Type mstr_Education_Type = db.Mstr_Education_Type.Find(id);

            db.Mstr_Education_Type.Remove(mstr_Education_Type);
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                TempData["gagalHapus"] = "Gagal Hapus, Data sudah digunakan";
                return(RedirectToAction("Index"));
            }
            TempData["berhasilHapus"] = "Berhasil Hapus Data.";
            return(RedirectToAction("Index"));
        }
コード例 #5
0
        // GET: EducationType/Edit/5
        public ActionResult Edit(short?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (TempData["shortMessage"] != null)
            {
                ViewBag.message = TempData["shortMessage"].ToString();
            }
            Mstr_Education_Type mstr_Education_Type = db.Mstr_Education_Type.Find(id);

            if (mstr_Education_Type == null)
            {
                return(HttpNotFound());
            }
            return(View(mstr_Education_Type));
        }