Esempio n. 1
0
        public string Delete(long id)
        {
            var employee = service.GetEmployee(id);

            service.DeleteEmployee(employee);

            return("Deleted successfully");
        }
Esempio n. 2
0
        // GET: Employee/Edit/5
        public ActionResult Edit(long id)
        {
            var employee = service.GetEmployee(id);

            if (employee == null)
            {
                return(HttpNotFound());
            }
            var employeeModel = new EmployeeModel {
                Id               = employee.Id,
                FirstName        = employee.FirstName,
                LastName         = employee.LastName,
                DateOfEmployment = employee.DateOfEmployment,
                Email            = employee.Email,
                DepartmentId     = employee.DepartmentId
            };

            ViewBag.DepartmentId = new SelectList(departmentService.GetAllDepartments(), "Id", "DepartmentName", employee.DepartmentId);
            return(View(employeeModel));
        }