public async Task <IActionResult> Destroy(DeleteSongViewModel deleteSong) { if (!this.ModelState.IsValid) { return(this.BadRequest()); } await this.songService.DestroyAsync(deleteSong.Id); return(this.RedirectToAction(nameof(this.Index))); }
public async Task <IActionResult> Delete(string id, string returnUrl = null) { Song song = null; GetSongForDeleteById query = new GetSongForDeleteById() { SongId = id }; string message = await this.CallServiceAsync( async() => song = await this.getSongForDelete.ExecuteAsync(query)); if (message != null) { return(View() .WithErrorMessage(message)); } DeleteSongViewModel model = Mapper.Map <DeleteSongViewModel>(song); ViewData["ReturnUrl"] = returnUrl; return(View(model)); }