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); }
public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _artistData.Add(Artist); _artistData.Commit(); TempData["Message"] = $"Artist: \"{Artist.Name}\" has been created"; return(RedirectToPage("./Index")); }