Exemplo n.º 1
0
        public async Task <ArtistDetailDto> CreateArtistAsync(ArtistToCreateDto artistToCreate)
        {
            var created = _map.MapToArtist(artistToCreate);

            _artist.Add(created);
            var result = await _artist.SaveAllAsync();

            var artistToReturn = _map.MapToArtistDetailDto(created);

            return(artistToReturn);
        }
Exemplo n.º 2
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _artistData.Add(Artist);

            _artistData.Commit();

            TempData["Message"] = $"Artist: \"{Artist.Name}\" has been created";

            return(RedirectToPage("./Index"));
        }