Beispiel #1
0
        public DeleteLanguageResult Delete(int?languageId, UserSessionObject user)
        {
            var result = new DeleteLanguageResult();

            if (languageId.HasValue)
            {
                if (!CheckReferencingBooks(languageId.Value))
                {
                    LanguageData domainModel = LanguageRepository.GetDataById(languageId.Value);
                    if (domainModel != null)
                    {
                        LanguageRepository.DeleteById(languageId.Value, user.UserId);
                        result = new DeleteLanguageResult(languageId.Value, domainModel.NameLanguage);
                    }
                }
                else
                {
                    result.Message = "This language can't be deleted. There are books connected to this language.";
                }
            }

            return(result);
        }