public IActionResult Delete(int departmentId)
        {
            DepartmentDAO dao = new DepartmentDAO();

            dao.Delete(departmentId);
            return(RedirectToAction("Index"));
        }
Example #2
0
        public void TestDeleteShouldReturnOne()
        {
            DepartmentDAO dao = new DepartmentDAO();
            Department    dep = dao.GetByDepartmentName("Medical");

            if (dep == null)//did delete run before create
            {
                TestCreateShouldReturnNewId();
                dep = dao.GetByDepartmentName("Medical");
            }
            Assert.IsTrue(dao.Delete(dep.GetIdAsString()) == 1);
        }
 public long Delete()
 {
     try
     {
         return(_dao.Delete(Id));
     }
     catch (Exception ex)
     {
         ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "Delete()");
         return(0);
     }
 }
Example #4
0
    public void TestDeleteShouldReturnOne()
    {
        DepartmentDAO dao = new DepartmentDAO();
        Department    dep = dao.GetByDepartment("Test Department");

        if (dep == null)                   // in case this test runs before the Create method test
        {
            TestCreateShouldReturnNewId(); // run it for sure
            dep = dao.GetByDepartment("Test Department");
        }

        Assert.IsTrue(dao.Delete(dep.GetIdAsString()) == 1);
    } // TestShouldReturnOne
Example #5
0
        public bool Delete()
        {
            bool deleteOk = false;

            try
            {
                deleteOk = _dao.Delete(Id);
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "DepartmentViewModel", "Delete");
            }

            return(deleteOk);
        }
Example #6
0
        public long Delete()
        {
            long delStatus = 0;

            try
            {
                delStatus = _dao.Delete(Id);
            }
            catch (Exception ex)
            {
                ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "Delete");
            }

            return(delStatus);
        }
Example #7
0
        public void DepartmentDAOCreateAndDeleteShouldReturnTrue()
        {
            bool          deleteOk = false;
            Department    dep      = new Department();
            DepartmentDAO dao      = new DepartmentDAO();

            dep.DepartmentName = "Human Resources";  // and some hardcoded data

            string newid = dao.Create(dep);

            if (newid.Length == 24) // new id's are a 24 byte hex string
            {
                deleteOk = dao.Delete(newid);
            }
            Assert.IsTrue(deleteOk);
        }
Example #8
0
 public static bool Delete(int id)
 {
     return(DepartmentDAO.Delete(id));
 }