private void deleteMedia(ViewRoutePointMediaObject media) { _log.AddStringEvent($"image deleted, passed mediaid:{media.RoutePointMediaObjectId}"); _routePointMediaManager.SetSyncStatus(media.RoutePointMediaObjectId, false, true); _routePointMediaManager.SetSyncStatus(media.RoutePointMediaObjectId, true, true); MediaFileManager fileManager = new MediaFileManager(); fileManager.Delete(media.RoutePointMediaObjectId, media.MediaType); }
private async Task <bool> updateImages(MediaForUpdate media, bool loadOnlyPreviewImg) { bool result = false; if (!media.IsDeleted) { if ((media.MediaType == MediaObjectTypeEnum.Audio || (media.MediaType == MediaObjectTypeEnum.Image && !loadOnlyPreviewImg)) && (!media.OriginalServerSynced)) { var httpStatus = await updateMediaFileAsync(media.RoutePointId, media.RoutePointMediaObjectId, media.MediaType, false); result = httpStatus == HttpStatusCode.OK; _routePointMediaManager.SetSyncStatus(media.RoutePointMediaObjectId, false, result); if (!result) { _log.AddStringEvent( $"media file update {media.RoutePointMediaObjectId}, original, http status:{HttpStatusCode.OK}"); } } if ((!media.PreviewServerSynced) && (media.MediaType == MediaObjectTypeEnum.Image)) { var httpStatus = await updateMediaFileAsync(media.RoutePointId, media.RoutePointMediaObjectId, media.MediaType, true); bool resultPreview = httpStatus == HttpStatusCode.OK; _routePointMediaManager.SetSyncStatus(media.RoutePointMediaObjectId, true, resultPreview); if (!resultPreview) { _log.AddStringEvent( $"media file update {media.RoutePointMediaObjectId}, preview, http status:{HttpStatusCode.OK}"); } if (result) { result = resultPreview; } } } else { _log.AddStringEvent($"image deleted, passed mediaid:{media.RoutePointMediaObjectId}"); _routePointMediaManager.SetSyncStatus(media.RoutePointMediaObjectId, false, true); _routePointMediaManager.SetSyncStatus(media.RoutePointMediaObjectId, true, true); MediaFileManager fileManager = new MediaFileManager(); fileManager.Delete(media.RoutePointMediaObjectId, media.MediaType); result = true; } return(result); }
private void DeleteMediaFile() { MediaFileManager fileManager = new MediaFileManager(); fileManager.Delete(_id, _mediaType); }