Example #1
0
        /// <inheritdoc />
        public async Task <ServiceResponse <int> > RemoveAnnotation(int annotationId)
        {
            var annotation = await _modelAnnotationsRepository.GetAnnotation(annotationId);

            if (annotation == null)
            {
                return(new ServiceResponse <int>
                {
                    StatusCode = 404, Message = "Annotation is not found.", MessageRu = "Аннотация не найдена."
                });
            }

            var(isEditable, accessResponse, guide) = await _guidesService.GuideIsEditable <int>(annotation.GuideId);

            if (!isEditable)
            {
                return(accessResponse);
            }

            await _modelAnnotationsRepository.DeleteAnnotation(annotation);

            return(new ServiceResponse <int>
            {
                Message = "Annotation is deleted successfully.", MessageRu = "Аннотация успешно удалена."
            });
        }