Example #1
0
        public IActionResult Delete(EmployeeDeleteViewModel model) //* part delete - step3  - update Employee
        {
            if (ModelState.IsValid)                                //* Part 42 - step2 model validation - next step in Create.cshtml
            {
                Employee employee = _employeeRepositry.GetEmployee(model.Id);

                _employeeRepositry.Delete(employee.Id);
                return(RedirectToAction("List")); //* Part 56 - need to comment this line
            }

            return(View());
        }