public IActionResult MyPost()
        {
            var artist = aartistRepository.GetArtitByUserNmae(User.Identity.Name);

            if (artist != null)
            {
                var post = aartistRepository.GetPostByIdArtist(artist.Id);

                var profile = aartistRepository.GetProfileArtistByIdAtris(artist.Id);
                List <ViewModels.Post> posts = post.Select(item => new ViewModels.Post
                {
                    Description  = item.Description,
                    Id           = item.Id,
                    Title        = item.Title,
                    Image        = Convert.ToBase64String(item.Image),
                    ImageProfile = Convert.ToBase64String(profile.ImageProfile),
                    NameProfile  = profile.FullName,
                    UploadTime   = item.UploadTime
                }).ToList();
                return(View(posts));
            }
            else
            {
                return(RedirectToAction("ArtistCard"));
            }
        }
Exemple #2
0
        public IActionResult GetPostsByIdArtist(int id)
        {
            var post    = aartistRepository.GetPostByIdArtist(id);
            var profile = aartistRepository.GetProfileArtistByIdAtris(id);

            List <ViewModels.Post> posts = post.Select(item => new ViewModels.Post
            {
                Description  = item.Description,
                Id           = item.Id,
                Title        = item.Title,
                Image        = Convert.ToBase64String(item.Image),
                ImageProfile = Convert.ToBase64String(profile.ImageProfile),
                NameProfile  = profile.FullName,
                UploadTime   = item.UploadTime
            }).ToList();

            return(PartialView("_Posts", posts));
        }