Ejemplo n.º 1
0
        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)));
        }
Ejemplo n.º 2
0
        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));
        }