Exemplo n.º 1
0
        public ActionResult Edit([Bind(Include = "Job_Category_Id,Job_Category_Code,Job_Category_Name,Order_Id")] Mstr_Job_Category mstr_Job_Category)
        {
            if (ModelState.IsValid)
            {
                db.Entry(mstr_Job_Category).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateException)
                {
                    Mstr_Job_Category job_category = db.Mstr_Job_Category.Find(mstr_Job_Category.Job_Category_Id);
                    if (job_category == null)
                    {
                        return(HttpNotFound());
                    }
                    TempData["shortMessage"] = "Kode Kategori Pekerjaan telah ada.";
                    return(RedirectToAction("Edit", mstr_Job_Category));

                    throw;
                }
                return(RedirectToAction("Index"));
            }
            return(View(mstr_Job_Category));
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Job_Category_Id,Job_Category_Code,Job_Category_Name,Order_Id")] Mstr_Job_Category mstr_Job_Category)
        {
            if (ModelState.IsValid)
            {
                db.Mstr_Job_Category.Add(mstr_Job_Category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(mstr_Job_Category));
        }
Exemplo n.º 3
0
        // GET: JobCategory/Details/5
        public ActionResult Details(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Mstr_Job_Category mstr_Job_Category = db.Mstr_Job_Category.Find(id);

            if (mstr_Job_Category == null)
            {
                return(HttpNotFound());
            }
            return(View(mstr_Job_Category));
        }
Exemplo n.º 4
0
        // GET: JobCategory/Delete/5
        //public ActionResult Delete(byte? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    Mstr_Job_Category mstr_Job_Category = db.Mstr_Job_Category.Find(id);
        //    if (mstr_Job_Category == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(mstr_Job_Category);
        //}

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

            db.Mstr_Job_Category.Remove(mstr_Job_Category);
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                TempData["gagalHapus"] = "Gagal Hapus, Data sudah digunakan";
                return(RedirectToAction("Index"));
            }
            TempData["berhasilHapus"] = "Berhasil Hapus Data.";
            return(RedirectToAction("Index"));
        }
Exemplo n.º 5
0
        // GET: JobCategory/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_Job_Category mstr_Job_Category = db.Mstr_Job_Category.Find(id);

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