public ActionResult DeleteConfirmed(int id)
        {
            TSTDepartment tSTDepartment = db.TSTDepartments.Find(id);

            db.TSTDepartments.Remove(tSTDepartment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "DepartmentID,Name,Description,IsActive")] TSTDepartment tSTDepartment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tSTDepartment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tSTDepartment));
 }
        public ActionResult Create([Bind(Include = "DepartmentID,Name,Description,IsActive")] TSTDepartment tSTDepartment)
        {
            if (ModelState.IsValid)
            {
                db.TSTDepartments.Add(tSTDepartment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tSTDepartment));
        }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TSTDepartment tSTDepartment = db.TSTDepartments.Find(id);

            if (tSTDepartment == null)
            {
                return(HttpNotFound());
            }
            return(View(tSTDepartment));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TSTDepartment tSTDepartment = db.TSTDepartments.Find(id);

            //Converting this hard delete into a soft delete in the Departments Controller

            //bool flip soft delete
            #region soft delete
            tSTDepartment.IsActive = !tSTDepartment.IsActive;
            #endregion


            //db.TSTDepartments.Remove(tSTDepartment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TSTDepartment tSTDepartment = db.TSTDepartments.Find(id);

            if (tSTDepartment.IsActive == true)
            {
                tSTDepartment.IsActive = false;
            }
            else
            {
                tSTDepartment.IsActive = true;
            }

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TSTDepartment tSTDepartment = db.TSTDepartments.Find(id);

            //db.TSTDepartments.Remove(tSTDepartment);
            //if (tSTDepartment.IsActive == true)
            //{
            //    tSTDepartment.IsActive = false;
            //}
            //else
            //{
            //    tSTDepartment.IsActive = false;
            //}
            tSTDepartment.IsActive = !tSTDepartment.IsActive;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }