public async Task <ActionResult <GalleryDTO> > GetGallery(Guid id) { Guid userId = new Guid(HttpContext.User.Identity.Name); if (await _galleryService.DoesGalleryExistAsync(id) == false) { return(NotFound()); } if (await _galleryService.IsGalleryOwnedByUserAsync(id, userId) == false) { return(Unauthorized()); } GalleryDTO dto = await _galleryService.GetGalleryAsync(id); return(Ok(dto)); }
public async Task <Gallery> Get(long id) { return(await GalleryService.GetGalleryAsync(id)); }