public ActionResult Details(int id)
        {
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            var reports = new Reports();

            reports = CARS2019.Models.TSProd.ReportGivenID(id);

            if (reports == null)
            {
                return(HttpNotFound());
            }
            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(View(reports));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            if (Session["canDeleteEntry"] != null)
            {
                if (Session["canDeleteEntry"].ToString() == "False")
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            int deleteResults = TSProd.DeleteReport(id);

            if (deleteResults == 0) // Successfully inserted report
            {
                return(RedirectToAction("Index"));
            }

            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(RedirectToAction("Index")); // Should go to error page *************************************************
        }
        public ActionResult ChangeStatus(int id, int reportStatus, string reworkType)
        {
            if (Session["canDeleteEntry"] != null)
            {
                if (Session["canDeleteEntry"].ToString() == "False")
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            int statusResults = TSProd.ChangeStatus(id, reportStatus);

            if (statusResults == 0) // Successfully inserted report
            {
                return(RedirectToAction("Index", new { reportStatus, reworkType }));
            }

            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(RedirectToAction("Index", new { reportStatus, reworkType })); // Should go to an error page *************************************************
        }
        public ActionResult Delete(int id)
        {
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (Session["canDeleteEntry"] != null)
            {
                if (Session["canDeleteEntry"].ToString() == "False")
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            var reports = new Reports();

            reports = CARS2019.Models.TSProd.ReportGivenID(id);

            if (reports == null)
            {
                return(HttpNotFound());
            }
            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(View(reports));
        }
        public ActionResult Edit(int id)
        {
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (Session["canEditEntry"] != null)
            {
                if (Session["canEditEntry"].ToString() == "False")
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            //Reports reports = db.Reports.Find(id);
            var reports = new Reports();

            reports = CARS2019.Models.TSProd.ReportGivenID(id);
            if (reports == null)
            {
                return(HttpNotFound());
            }

            var items = CARS2019.Models.TSProd.CARSDepartmentList().ToList();

            if (items != null)
            {
                ViewBag.data = items;
            }

            var checkedDepartmentList = TSProd.GetChecksGivenReportID(id);

            if (checkedDepartmentList != null)
            {
                ViewData["checkedDepartmentList"] = checkedDepartmentList;
            }

            return(View(reports));
        }