Пример #1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            _artistService.DeleteArtist(new DeleteArtistRequest {
                Id = id
            });

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public async Task <IActionResult> DeleteArtist(int id)
        {
            var artist = await _artistService.GetArtistById(id);

            await _artistService.DeleteArtist(artist);

            return(NoContent());
        }
Пример #3
0
        private object DeleteArtist()
        {
            var resource = Request.Body.FromJson <ArtistEditorResource>();

            foreach (var artistId in resource.ArtistIds)
            {
                _artistService.DeleteArtist(artistId, false);
            }

            return(new object());
        }
Пример #4
0
        public IActionResult DeleteArtist(long id)
        {
            try
            {
                _artistService.DeleteArtist(id);
            }
            catch (ArgumentException)
            {
                return(NotFound(StatusCodes.Status404NotFound));
            }

            return(Ok(StatusCodes.Status200OK));
        }
Пример #5
0
 public ActionResult Delete(int id, Artist artist)
 {
     try
     {
         // TODO: Add delete logic here
         _artist.DeleteArtist(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(artist));
     }
 }
Пример #6
0
        public IActionResult DeleteArtist(long id)
        {
            try
            {
                ArtistService.DeleteArtist(id);
            }
            catch (ArgumentException e)
            {
                log.LogError("An artist with the id :" + id + " does not exist." + e.Message);
                return(NotFound(StatusCodes.Status404NotFound));
            }

            return(Ok(StatusCodes.Status200OK));
        }
        public async Task <DataRespone <string> > Delete(int id)
        {
            bool result = await _artistService.DeleteArtist(id);

            if (result)
            {
                return new DataRespone <string>()
                       {
                           Ok = true, data = "Artist " + id + " has been removed.", error = ""
                       }
            }
            ;
            throw new MyNotFoundException(HttpStatusCode.NotFound, "Artist have not found.");
        }
    }
Пример #8
0
        public async Task <IActionResult> DeleteArtist(int id)
        {
            if (id == 0)
            {
                return(BadRequest());
            }

            var artist = await _artistService.GetArtistById(id);

            if (artist == null)
            {
                return(NotFound());
            }

            await _artistService.DeleteArtist(artist);

            return(NoContent());
        }
Пример #9
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var artist = await _artistService.DeleteArtist(id);

                if (artist == null)
                {
                    return(NotFound());
                }

                return(Ok("Deleted Successfully!"));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Failed to delete record!"));
            }
        }
Пример #10
0
        public async Task <ActionResult> DeletArtistById(int id)
        {
            try
            {
                var artist = await _artistService.GetArtistById(id);

                if (artist == null)
                {
                    return(BadRequest("l'artist est null"));
                }
                await _artistService.DeleteArtist(artist);

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #11
0
        public async Task <ActionResult> DeleteArtist(int id)
        {
            try
            {
                var artistToDelete = await _artistService.GetArtistById(id);

                if (artistToDelete == null)
                {
                    return(BadRequest("Cannot delete this artist because it doesn't exist."));
                }

                await _artistService.DeleteArtist(artistToDelete);

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public async Task <ActionResult> DeleteArtist(int id)
        {
            try
            {
                var artistToDelete = await _artistService.GetArtistById(id);

                if (artistToDelete == null)
                {
                    return(NotFound("Artist not found"));
                }

                await _artistService.DeleteArtist(artistToDelete);

                return(Ok("The artist is deleted"));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #13
0
        public async Task <ActionResult> Delete(int id)
        {
            await artistService.DeleteArtist(id);

            return(Ok());
        }
Пример #14
0
 public IActionResult DeleteArtist(int id)
 {
     _artistService.DeleteArtist(id);
     return(NoContent());
 }
Пример #15
0
 public void DeleteArtist(int id)
 {
     artistService.DeleteArtist(id);
 }
 public bool Execute()
 {
     return(_service.DeleteArtist(_command.Artist));
 }
Пример #17
0
        private static void TestArtistService()
        {
            List <int> list = new List <int>();

            artistService = Container.Resolve <IArtistService>();
            clientService = Container.Resolve <IClientService>();

            //Create
            artistService.CreateArtist(new ArtistDTO
            {
                Name       = "Bullet For My Valentine",
                Info       = "Bullet for My Valentine are a Welsh heavy metal band from Bridgend, formed in 1998.The band is composed of Matthew Tuck(lead vocals, rhythm guitar), Michael Paget(lead guitar, backing vocals), Michael Thomas(drums) and Jamie Mathias(bass guitar).",
                IsOfficial = true,
                CreatorID  = clientID
            });
            artistService.CreateArtist(new ArtistDTO
            {
                Name       = "Viola Martinsson",
                Info       = "Viola Martinsson is a Swedish singer and musician born in 1991 in Söråker, Sweden. Her version of “Made Of” was recorded specifically to become the music theme for the Volvo campaign “Made of Sweden”, and is a cover of the 2012 track of the same name from Nause.",
                IsOfficial = true,
                CreatorID  = clientID
            });

            //GetArtistIdByName
            artistID = artistService.GetArtistIdByName("Bullet For My Valentine");
            int violaID = artistService.GetArtistIdByName("Viola Martinsson");

            list.Add(artistID);
            list.Add(violaID);
            Console.WriteLine(list.Count() == 2 ? "ClientService - GetArtistIdByName - OK" : "ClientService - GetArtistIdByName - FAIL");



            //GetArtisById
            ArtistDTO bfmv = artistService.GetArtist(artistID);

            Console.WriteLine(bfmv.Name == "Bullet For My Valentine" ? "ArtistService - TestGetArtisById - OK" : "ArtistService - TestGetArtisById - FAIL");

            //ListAllArtists01
            // var artists = artistService.ListAllArtists(new ArtistFilter { Name = "Viola Martinsson" }, 1);
            // Console.WriteLine(artists.TotalResultCount == 1 ? "ArtistService - TestListAllArtists01 - OK" : "ArtistService - TestListAllArtists01 - FAIL");

            //ListAllArtists02
            var artists2 = artistService.ListAllArtists();

            Console.WriteLine(list.Count() == 2 ? "ClientService - ListAllArtists02 - OK" : "ClientService - ListAllArtists02 - FAIL");


            //EditArtist
            bfmv.Name = "BFMV";
            artistService.EditArtist(bfmv, bfmv.AlbumIDs);
            ArtistDTO bfmvFromDB = artistService.GetArtist(bfmv.ID);

            Console.WriteLine(bfmvFromDB.Name == "BFMV" ? "ArtistService - TestEditArtist - OK" : "ArtistService - TestEditArtist - FAIL");

            //DeleteArtist
            artistService.DeleteArtist(violaID);
            int violaIDFromDB = artistService.GetArtistIdByName("Viola Martinsson");

            Console.WriteLine(violaIDFromDB < 1 ? "ArtistService - TestDeleteArtist - OK" : "ArtistService - TestDeleteArtist - FAIL");

            //GetCreator
            ClientDTO creator = artistService.GetCreator(bfmv.ID);

            Console.WriteLine(creator.ID == clientID ? "ArtistService - GetCreator - OK" : "ArtistService - GetCreator - FAIL");
        }
Пример #18
0
 protected override Func <ServiceOperationResult> DeleteEntityAndReturnOperationResult(Artist artist, bool onlyChangeFlag = true)
 {
     return(() => _artistService.DeleteArtist(artist, onlyChangeFlag));
 }