public async Task <bool> DeleteAlbum(int id) { if (!HttpContext.User.Identity.IsAuthenticated) { throw new ApiException("You have to be logged in to modify data", 401); } return(await AlbumRepo.DeleteAlbum(id)); }
public ActionResult Delete(int albumId) { Album deletedAlbum = repository.DeleteAlbum(albumId); if (deletedAlbum != null) { TempData["message"] = string.Format("{0} was deleted", deletedAlbum.Name); } return(RedirectToAction("Index")); }
public ActionResult DeleteAlbumConfirmed(int albumId) { try { _albumRepository.DeleteAlbum(albumId); } catch { } return(RedirectToAction("AdminList")); }
public ActionResult Delete(EditAlbumViewModel model, FormCollection collection) { Album album = AlbumMapper.MapEditAlbumViewModel(model, userID); albumRepository.DeleteAlbum(album); List <Album> albumsDB = albumRepository.GettAllAlbumsByUserID(userID); List <ListAlbumViewModel> albums = new List <ListAlbumViewModel>(); albumsDB.ForEach(x => albums.Add(AlbumMapper.MapListAlbumViewModel(x))); return(PartialView("_Items", albums)); }
public async Task DeleteAlbumShouldAuthorizeAlbumDeletion() { _sut.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "User") }, "AuthenticationType")) } }; _albumRepository.DeleteAlbum(1).Returns(true); var didDelete = await _sut.DeleteAlbum(1); Assert.IsTrue(didDelete); }
//删除指定的相册 public IActionResult Delete(int albumId) { repository.DeleteAlbum(albumId); return(View()); }
public void DeleteAlbum(string albumName) { _albumRepository.DeleteAlbum(albumName); }
public void DeleteAlbum(int id) { _repository.DeleteAlbum(id); }
public bool DeleteAlbum(int albumID) { var result = _albumRepository.DeleteAlbum(albumID) > 0 ? true : false; return(result); }