Esempio n. 1
0
        public ActionResult Edit([Bind(Include = "Religion_Id,Religion_Code,Religion_Name,Order_Id")] Mstr_Religion mstr_Religion)
        {
            if (ModelState.IsValid)
            {
                db.Entry(mstr_Religion).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateException)
                {
                    Mstr_Religion religion = db.Mstr_Religion.Find(mstr_Religion.Religion_Id);
                    if (religion == null)
                    {
                        return(HttpNotFound());
                    }
                    TempData["shortMessage"] = "Kode Agama telah ada.";
                    return(RedirectToAction("Edit", mstr_Religion));

                    throw;
                }
                return(RedirectToAction("Index"));
            }
            return(View(mstr_Religion));
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "Religion_Id,Religion_Code,Religion_Name,Order_Id")] Mstr_Religion mstr_Religion)
        {
            if (ModelState.IsValid)
            {
                db.Mstr_Religion.Add(mstr_Religion);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(mstr_Religion));
        }
Esempio n. 3
0
        // GET: Religion/Details/5
        public ActionResult Details(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Mstr_Religion mstr_Religion = db.Mstr_Religion.Find(id);

            if (mstr_Religion == null)
            {
                return(HttpNotFound());
            }
            return(View(mstr_Religion));
        }
Esempio n. 4
0
        // GET: Religion/Delete/5
        //public ActionResult Delete(byte? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    Mstr_Religion mstr_Religion = db.Mstr_Religion.Find(id);
        //    if (mstr_Religion == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(mstr_Religion);
        //}

        // POST: Religion/Delete/5
        //[HttpPost, ActionName("Delete")]
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(byte id)
        {
            Mstr_Religion mstr_Religion = db.Mstr_Religion.Find(id);

            db.Mstr_Religion.Remove(mstr_Religion);
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                TempData["gagalHapus"] = "Gagal Hapus, Data sudah digunakan";
                return(RedirectToAction("Index"));
            }
            TempData["berhasilHapus"] = "Berhasil Hapus Data.";
            return(RedirectToAction("Index"));
        }
Esempio n. 5
0
        // GET: Religion/Edit/5
        public ActionResult Edit(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (TempData["shortMessage"] != null)
            {
                ViewBag.message = TempData["shortMessage"].ToString();
            }
            Mstr_Religion mstr_Religion = db.Mstr_Religion.Find(id);

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