public void EmployeeModelDeleteShouldReturnOne()
 {
     EmployeeModel model = new EmployeeModel();
     Employee deleteEmp = model.GetByLastName("Employee");
     int employeesDeleted = model.Delete(deleteEmp.Id);
     Assert.IsTrue(employeesDeleted == 1);
 }
Пример #2
0
        public void Employee_Delete()
        {
            EmployeeModel model           = new EmployeeModel();
            int           employeeDeleted = model.Delete(12);

            Assert.True(employeeDeleted == 1);
        }
Пример #3
0
        public void EmployeeModelDeleteShouldReturnOne()
        {
            EmployeeModel model           = new EmployeeModel();
            Employee      deleteEmployee  = model.GetByLastname("Nguyen");
            int           EmployeeDeleted = model.Delete(deleteEmployee.Id);

            Assert.IsTrue(EmployeeDeleted == 1);
        }
Пример #4
0
        public void EmployeeModelDeleteShouldReturnOne()
        {
            EmployeeModel model            = new EmployeeModel();
            Employee      deleteEmployee   = model.GetByEmail("*****@*****.**");
            int           EmployeesDeleted = model.Delete(deleteEmployee.Id);

            Assert.IsTrue(EmployeesDeleted == 1);
        }
        public ActionResult Delete(int id)
        {
            EmployeeModel employee = new EmployeeModel();

            employee.Delete(id);

            return(RedirectToAction("Index"));
        }
Пример #6
0
 public void Delete(int _id)
 {
     using (EmployeeEntities context = new EmployeeEntities())
     {
         EmployeeModel em   = new EmployeeModel(context);
         var           item = em.GetItemById(_id);
         if (item != null && item.PictureUrl != null)
         {
             RemovePhoto(item.Id, item.PictureUrl);
         }
         em.Delete(_id);
     }
 }
Пример #7
0
        //delete
        public int Delete()
        {
            int employeesDeleted = -1;

            try
            {
                employeesDeleted = _model.Delete(Id);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + MethodBase.GetCurrentMethod().Name + ex.Message);
            }
            return(employeesDeleted);
        }
        public int Delete()
        {
            int empdentDeleted = -1;

            try
            {
                empdentDeleted = _model.Delete(Id);
            }
            catch (Exception ex)
            {
                LastName = "not found";
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }
            return(empdentDeleted);
        }
        public int Delete()
        {
            int employeesDeleted = -1;

            try
            {
                // call delete that matches the id
                employeesDeleted = _model.Delete(Id);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " +
                                  MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            } // try/catch
            // return delete status
            return(employeesDeleted);
        }
Пример #10
0
        // Delete a Employee
        public int Delete()
        {
            // Sets the number of Employees deleted
            // None of been deleted until we try and actually remove them
            // from the database
            int EmployeesDeleted = -1;

            try
            {
                // Trys to delete the Employee from the database
                // The Id is past from the EmployeeController from the object
                // that called the inital Delete function
                EmployeesDeleted = _model.Delete(Id);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " +
                                  MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }

            // Returns the number of employees deleted
            return(EmployeesDeleted);
        }
Пример #11
0
 public ActionResult Delete(EmployeeModel model)
 {
     model.Delete(model.Form1.EmployeeID);
     return(RedirectToAction("Index"));
 }