Esempio n. 1
0
        public async Task <SpecializationResponse> DeleteAsync(int id)
        {
            var existingSpecialization = await specializationRepository.FindByIdAsync(id);

            if (existingSpecialization == null)
            {
                return(new SpecializationResponse("Специализация не найдена!"));
            }
            try
            {
                specializationRepository.Remove(existingSpecialization);
                await unitOfWork.CompleteAsync();

                return(new SpecializationResponse(existingSpecialization));
            }
            catch (Exception ex)
            {
                return(new SpecializationResponse($"Ошибка при удалении Специализации: {ex.Message}"));
            }
        }