public void DeleteAlbumTest() { _albumService.DeleteAlbum(_album1Id); _albumService.DeleteAlbum(_album2Id); Assert.IsNull(_albumService.GetAlbum(_album1Id)); Assert.IsNull(_albumService.GetAlbum(_album2Id)); }
public async Task <IHttpActionResult> Delete(int Id) { Response res = null; try { _albumService.DeleteAlbum(Id); res = new Response() { ResponseCode = "200", ResponseMessage = "Success", Result = "Album deleted successfully" }; } catch (Exception ex) { res = new Response() { ResponseCode = HttpStatusCode.InternalServerError.ToString(), ResponseMessage = "Exception", Result = ex.Message.ToString() }; } return(Ok(res)); }
public IActionResult Destroy(int albumId) { var userId = albums.GetUserId(albumId); albums.DeleteAlbum(albumId); return(RedirectToAction(nameof(Index), new { id = userId })); }
public ActionResult DeleteConfirmed(Guid id) { _albumService.DeleteAlbum(new DeleteAlbumRequest { Id = id }); return(RedirectToAction("Index")); }
public ActionResult Delete(string albumName) { string login = User.Identity.Name; albumService.DeleteAlbum(login, albumName); return(RedirectToAction("EditAlbums")); }
public void DeleteAlbum(int id) { var album = _albumService.GetAlbumById(id); var user = GetCurrentLoggedUser().Result; if (user.Albums.Contains(album)) { _albumService.DeleteAlbum(id); } }
public IActionResult DeleteAlbum(long id) { try { AlbumService.DeleteAlbum(id); } catch (ArgumentException e) { log.LogError("The album with the id :" + id + " does not exist." + e.Message); return(NotFound(StatusCodes.Status404NotFound)); } return(Ok(StatusCodes.Status200OK)); }
public JsonResult DeleteAlbum(string albumID) { FindItemReponse <AlbumModel> albumResponse = _albumService.FindAlbumByID(albumID); var albumActionURL = albumResponse.Item.ActionURL; FindAllItemReponse <PhotoModel> photoResponse = _photoService.GetPhotoByAlbum(albumActionURL, 1, 1); if (photoResponse.Items.Count == 0) { BaseResponse response = _albumService.DeleteAlbum(albumID); return(Json(new { ErrorCode = response.ErrorCode, Message = response.Message }, JsonRequestBehavior.AllowGet)); } return(Json(new { ErrorCode = (int)ErrorCode.Error, Message = Resources.AdminResource.msg_notEmptyAlbum }, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> Delete(int id) { try { var album = await _albumService.DeleteAlbum(id); if (album == null) { return(NotFound()); } return(Ok("Deleted Successfully!")); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Failed to delete record!")); } }
public ActionResult DeleteConfirmed(int id) { bool deleteSuccessful = _albumService.DeleteAlbum(id); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { albumService.DeleteAlbum(id); return(RedirectToAction("Index")); }
protected override Func <ServiceOperationResult> DeleteEntityAndReturnOperationResult(Album album, bool onlyChangeFlag = true) { return(() => _albumService.DeleteAlbum(album, onlyChangeFlag)); }
public void DeleteAlbum(int id) { albumService.DeleteAlbum(id); }
public ActionResult DeleteReally(int id) { _albumService.DeleteAlbum(id); return(RedirectToAction("Index")); }
private static void TestAlbumService() { List <int> list = new List <int>(); albumService = Container.Resolve <IAlbumService>(); clientService = Container.Resolve <IClientService>(); //Create albumService.CreateAlbum(new AlbumDTO { Name = "The Poison", ArtistID = artistID, IsOfficial = true, CreatorID = clientID, }); albumService.CreateAlbum(new AlbumDTO { Name = "Venom", ArtistID = artistID, IsOfficial = true, CreatorID = clientID }); //GetAlbumIdByName albumID = albumService.GetAlbumIdByName("The Poison"); int venomID = albumService.GetAlbumIdByName("Venom"); list.Add(albumID); list.Add(venomID); Console.WriteLine(list.Count() == 2 ? "ClientService - GetAlbumIdByName - OK" : "ClientService - GetAlbumIdByName - FAIL"); //GetAlbumById AlbumDTO poison = albumService.GetAlbum(albumID); AlbumDTO venom = albumService.GetAlbum(venomID); Console.WriteLine(poison.Name == "The Poison" ? "AlbumService - GetAlbumById - OK" : "AlbumService - GetAlbumById - FAIL"); artistService = Container.Resolve <IArtistService>(); //AddAlbum albumService.AddAlbum(poison); albumService.AddAlbum(venom); ArtistDTO artist = artistService.GetArtist(artistID); Console.WriteLine(artist.AlbumIDs.Contains(albumID) ? "AlbumService - AddAlbum - OK" : "AlbumService - AddAlbum - FAIL"); //GetArtistOfAlbum ArtistDTO artist2 = albumService.GetArtistOfAlbum(albumID); Console.WriteLine(artist2.ID == artistID ? "AlbumService - GetArtistOfAlbum - OK" : "AlbumService - GetArtistOfAlbum - FAIL"); //TestArtistServisGetAllAlbums Console.WriteLine(artist.AlbumIDs.Count() == 2 ? "ArtistService - TestArtistServisGetAllAlbums - OK" : "ArtistService - TestArtistServisGetAllAlbums - FAIL"); //ListAllAlbums var albums = albumService.ListAllAlbums(new AlbumFilter { Name = "The Poison" }, 1); Console.WriteLine(albums.TotalResultCount == 2 ? "AlbumService - TestListAllAlbums - OK" : "AlbumService - TestListAllAlbums - FAIL"); //ListAllAlbumss02 var albums2 = albumService.ListAllAlbums(); Console.WriteLine(albums2.Count() == 2 ? "AlbumService - ListAllAlbumss02 - OK" : "AlbumService - ListAllAlbumss02 - FAIL"); //EditAlbum poison.Name = "The Poisonous Poison"; albumService.EditAlbum(poison, artistID, null, null); AlbumDTO poisonFromDB = albumService.GetAlbum(poison.ID); Console.WriteLine(poisonFromDB.Name == "The Poisonous Poison" ? "AlbumService - TestEditAlbum - OK" : "AlbumService - TestEditAlbum - FAIL"); //DeleteAlbum albumService.DeleteAlbum(venomID); try { AlbumDTO venomFromDB = albumService.GetAlbum(venomID); Console.WriteLine("AlbumService - TestDeleteAlbum - FAIL"); } catch (NullReferenceException) { Console.WriteLine("AlbumService - TestDeleteAlbum - OK"); } //GetCreator ClientDTO creator = genreService.GetCreator(poison.ID); Console.WriteLine(creator.ID == clientID ? "AlbumService - GetCreator - OK" : "AlbumService - GetCreator - FAIL"); }
public void DeleteAlbum(int albumId) { _albumService.DeleteAlbum(albumId); }
protected override void DeleteEntity(Album local, bool deleteFiles) { _albumService.DeleteAlbum(local.Id, true); }
public void Remover(int id) { _AlbumService.DeleteAlbum(id); }