/// <inheritdoc /> public async Task <ServiceResponse <List <GetModelAnnotationDto> > > GetPublicModelAnnotations(int guideId) { var(isPublic, accessResponse, guide) = await _guidesService.GuideIsPublic <List <GetModelAnnotationDto> >(guideId); if (!isPublic) { return(accessResponse); } var annotations = await _modelAnnotationsRepository.GetAnnotations(guideId); return(new ServiceResponse <List <GetModelAnnotationDto> > { Data = annotations.Select(x => _mapper.Map <GetModelAnnotationDto>(x)).ToList() }); }
/// <inheritdoc /> public async Task <ServiceResponse <int> > RemoveGuide(int guideId) { var(isEditable, accessResponse, guide) = await GuideIsEditable <int>(guideId, true); if (!isEditable) { return(accessResponse); } var serviceResponse = new ServiceResponse <int>(); var guideModelAnnotations = await _modelAnnotationsRepository.GetAnnotations(guideId); _fileManager.DeleteFolder(guideId); await _modelAnnotationsRepository.DeleteAnnotations(guideModelAnnotations); await _guidesRepository.RemoveGuide(guide); serviceResponse.Message = "Guide is deleted successfully."; serviceResponse.MessageRu = "Гайд удален успешно."; return(serviceResponse); }