Example #1
0
        /// <inheritdoc />
        public async Task <ServiceResponse <int> > AddModelAnnotation(AddModelAnnotationDto newAnnotation)
        {
            var(isEditable, accessResponse, guide) =
                await _guidesService.GuideIsEditable <int>((int)newAnnotation.GuideId !);

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

            var annotation = _mapper.Map <ModelAnnotation>(newAnnotation);

            var annotationId = await _modelAnnotationsRepository.AddAnnotation(annotation);

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