Esempio n. 1
0
        protected IActivityObject GetDalObject(Activity activity)
        {
            //Logger.Instance.Debug($"getting dal object for type {Type} with Id {Id}");
            switch (Type)
            {
            case "user":
                return(Users.GetById((uint)Id));

            case "sitegroup_group":
                return(Groups.GetById((uint)Id));

            case "sitepage_page":
                return(Pages.GetById((uint)Id));

            case "album_photo":
                return(AlbumPhotos.GetById((uint)Id));

            case "core_link":
                return(CoreLinks.GetById((uint)Id));

            default:
                //throw new Exception($"Unknown type {Type} for Dal Object for entity type {_entityType}");
                return(new DummeyActivityObject());
            }
        }
        public FlickrRepository(IConfiguration config, IMapper mapper)
        {
            _config = config;
            _mapper = mapper;

            AlbumImages = new AlbumPhotos();
            AlbumsList  = new AlbumsRefresh();
        }
Esempio n. 3
0
        //
        public FeedAttachmentPhoto(ActivityAttachment attachment, ulong actionId)
        {
            _photo          = AlbumPhotos.GetById(attachment.id);
            attachment_id   = attachment.id;
            attachment_type = "album_photo";
            title           = _photo.title;
            body            = HttpUtility.HtmlDecode(_photo.description);

            //uri = $"https://beta.koobeca.com/advancedalbums/photo/view/album_id/{_photo.album_id}/photo_id/{_photo.photo_id}";
            //uri = $"https://beta.koobeca.com/core/link/index/action_id/{actionId}";
            uri        = $"https://beta.koobeca.com/view.php?action_id={actionId}";
            image_main = _photo.file_id > 0 ? new FeedImage(_photo.file_id) : null;
            mode       = (uint)(attachment.mode ? 1 : 0);
        }
Esempio n. 4
0
        public IActionResult AddPhoto([FromBody] AlbumPhotos albumPhotos)
        {
            try
            {
                if (_repository.AlbumPhotos.Exists(albumPhotos.PhotoId))
                {
                    return(BadRequest());
                }
                albumPhotos = _repository.AlbumPhotos.AddPhoto(albumPhotos);

                return(Ok(albumPhotos));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error" + ex));
            }
        }
Esempio n. 5
0
        public IActivityObject GetActivityObject()
        {
            switch (type)
            {
            case "core_link":
                return(CoreLinks.GetById(id));

            case "album_photo":
                return(AlbumPhotos.GetById(id));

            case "video":
                return(Videos.GetById(id));

            default:
                return(null);
            }
        }
Esempio n. 6
0
        protected override void RemoveRecordFromTable(object refRecord)
        {
            Comment comment = refRecord as Comment;

            Comments.Remove(comment.comment_id);
            if (!string.IsNullOrEmpty(comment.attachment_type) && comment.attachment_id != 0)
            {
                uint fileId = 0;
                //remove attachment
                if (comment.attachment_type == "album_photo")
                {
                    var photo = AlbumPhotos.GetById((uint)comment.attachment_id);
                    fileId = photo.file_id;
                }

                if (fileId != 0)
                {
                    Logger.Instance.Debug($"Removing storage file {fileId}");
                    Storages.DeleteByFileId(fileId);
                }
            }
        }
Esempio n. 7
0
 public AlbumPhoto Get(uint photoId)
 {
     ///
     return(AlbumPhotos.GetById(photoId));
 }