Exemplo n.º 1
0
        //
        // GET: /JobMode/Delete/5

        //public ActionResult  Delete(int id = 0)
        //{
        //    JobMode jobmode = objSourceMastersModel.GetJobModeById(id);
        //    if (jobmode == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(jobmode);
        //}

        //
        // POST: /JobMode/Delete/5

        //[HttpPost, ActionName("Delete")]
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            var isinuse = (from d in db.JobGenerations where d.JobStatusId == id select d).ToList();

            if (isinuse.Count == 0)
            {
                objSourceMastersModel.DeleteJobStatus(id);
                ViewBag.SuccessMsg = "You have successfully deleted Job Status.";
                return(View("Index", objSourceMastersModel.GetJobStatus()));
            }
            else
            {
                ViewBag.ErrorMsg = "Can not delete, Job Status in use.";
                return(View("Index", objSourceMastersModel.GetJobStatus()));
            }
        }