Exemplo n.º 1
0
        public async Task <IActionResult> CreateSongComposers(int id)
        {
            var songCreate = await _songService.GetSongCreateByIdAsync(id);

            return(View(new CreateSongComposersViewModel
            {
                CreateSongId = id,
                Title = songCreate.Title,
                ContributorsListAsJSON = JsonConvert.SerializeObject(await _contributorService.GetAllByNameAndIdAsync())
            }));
        }
Exemplo n.º 2
0
        public async Task <FileStreamResult> ContributorsFile()
        {
            var memoryStream = new MemoryStream();
            var contributors = await _contributorService.GetAllByNameAndIdAsync();

            var bytes = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(contributors));

            memoryStream.Write(bytes, 0, bytes.Length);
            var fileStreamResult = new FileStreamResult(memoryStream, "application/json");

            fileStreamResult.FileDownloadName    = "contributors.json";
            fileStreamResult.FileStream.Position = 0;
            return(fileStreamResult);
        }