Exemplo n.º 1
0
        public async Task <IActionResult> GetTrackDetails(int id)
        {
            var track = await Tracks
                        .FirstOrDefaultAsync(f => f.TrackId == id);

            if (track == null)
            {
                return(NotFound());
            }
            if (track.Privacy != "public" &&
                (User == null || !User.HasClaim(c => c.Type == "privacy" && c.Type == track.Privacy)))
            {
                return(Forbid());
            }

            track.TrackFile = await GetFolderUrl(track.FolderId) + track.TrackFile;

            return(new ObjectResult(track));
        }