Ejemplo n.º 1
0
        public void DepartmentDAOUpdateTwiceShouldReturnNegative()
        {
            DepartmentDAO dao = new DepartmentDAO();
            //simulate 2 users getting an employee
            Department dep  = dao.GetByID("564107b33dd4ed255425f4c5"); //administrations' id
            Department dep2 = dao.GetByID("564107b33dd4ed255425f4c5"); //administrations' id

            dep.DepartmentName = "Administration";
            int rowsUpdated = dao.Update(dep);

            if (rowsUpdated == 1)
            {
                rowsUpdated = dao.Update(dep2);
            }
            Assert.IsTrue(rowsUpdated == -2);
        }
Ejemplo n.º 2
0
        public void DepartmentDAOUpdateShouldReturnTrue()
        {
            DepartmentDAO dao = new DepartmentDAO();
            //simulate user 1 getting an employee
            Department dep = dao.GetByID("564107b33dd4ed255425f4c5"); //administrations' id

            dep.DepartmentName = "Administration";
            int rowsUpdated = dao.Update(dep);

            //user 1 makes update
            Assert.IsTrue(rowsUpdated == 1);
        }
Ejemplo n.º 3
0
 //
 //find Department with surnme from dal
 //
 public void GetByID(string id)
 {
     try
     {
         Department dep = _dao.GetByID(id);
         Id             = dep._id.ToString();
         DepartmentName = dep.DepartmentName;
         Entity64       = Convert.ToBase64String(Serializer(dep));
     }
     catch (Exception ex)
     {
         ErrorRoutine(ex, "DepartmentViewModel", "GetByID");
     }
 }
        public IActionResult Edit(int departmentId)
        {
            DepartmentDAO dao = new DepartmentDAO();

            return(View(dao.GetByID(departmentId)));
        }