public async Task DeleteAsync_ById_Ok() { //Arrange int id = 3; //Act var actual = await _albumService.DeleteAsync(id); //Assert actual.Should().BeTrue(); }
public async Task <IActionResult> Delete(int id) { var albumEntity = await _albumService.GetByIdAsync(id); await _albumService.DeleteAsync(albumEntity); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> DeteteAsync(ObjectId id) { var album = await _albumService.GetAsync(id); if (album == null) { return(NotFound()); } await _albumService.DeleteAsync(id); return(NoContent()); }
public async Task <ActionResult <AlbumEntity> > DeleteAlbumEntity(int id) { if (id <= 0) { return(NotFound()); } var albumEntity = await _albumService.GetByIdAsync(id); if (albumEntity == null) { return(NotFound()); } await _albumService.DeleteAsync(id); return(Ok(albumEntity)); }
public async Task<ActionResult> Delete(int id, IFormCollection collection) { var model = await _albumService.GetByIdAsync(id); if (model == null) { return RedirectToAction(nameof(Index)); // return NotFound(); } try { await _albumService.DeleteAsync(model); return RedirectToAction(nameof(Index)); } catch { return View(); } }
public async Task <ActionResult <bool> > Delete(int id) { try { var result = await _albumService.GetAsync(id); if (result == null) { return(NotFound()); } return(Ok(await _albumService.DeleteAsync(id))); } catch (Exception ex) { return(Conflict(ex.Message)); throw; } }
public async Task <IActionResult> Delete(int id) { var album = await _albumService.GetByIdAsync(id); if (album == null) { return(RedirectToAction(nameof(Index))); // return NotFound(); } try { await _albumService.DeleteAsync(album); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public async Task <IActionResult> OnPostDeleteAsync(params long[] id) { await _service.DeleteAsync(id); return(JsonData(true)); }
public async Task <IActionResult> DeleteConfirmed(int id) { await _albumService.DeleteAsync(id); return(RedirectToAction(nameof(Index))); }