コード例 #1
0
        public async Task <IActionResult> GetMetadata(string fileId)
        {
            var userIdClaim = User.Claims.Single(c => c.Type == "id");
            var user        = await _userManager.FindByIdAsync(userIdClaim.Value);

            if (Guid.TryParse(fileId, out Guid id))
            {
                return(BadRequest("Invalid file id"));
            }

            var file = _fileData.GetFile(id);

            if (file == null)
            {
                return(BadRequest("File not found."));
            }
            return(new ObjectResult(file.Metadata));
        }