Ejemplo n.º 1
0
        public IActionResult DeleteEmployee(Guid EmpId)
        {
            var employeeFromRepo = _appRepository.GetEmployee(EmpId);

            if (employeeFromRepo == null)
            {
                return(NotFound());
            }

            _appRepository.DeleteEmployee(employeeFromRepo);

            if (!_appRepository.Save())
            {
                throw new Exception($"Deletion of employee with id { EmpId} failed on save.");
            }

            return(NoContent());
        }