// UploadPicture <albumName> <pictureTitle> <pictureFilePath>
        public string Execute(string[] data)
        {
            string albumTitle   = data[0];
            string pictureTitle = data[1];
            string picturePath  = data[2];

            Album album = albumServise.GetAlbumByName(albumTitle);

            Picture picture = pictureService.UploadPicture(album, pictureTitle, picturePath);

            return($"Picture {picture.Title} added to {album.Name}!");
        }
Esempio n. 2
0
        // AddTagTo <albumName> <tag>
        public string Execute(string[] data)
        {
            string albumTitle = data[0];
            string tagName    = data[1].ValidateOrTransform();
            Album  album      = null;
            Tag    tag        = null;

            try
            {
                album = albumServise.GetAlbumByName(albumTitle);

                tag = tagService.GetTagByName(tagName);

                albumTagService.AddTagToAlbum(album, tag);
            }
            catch (ArgumentException)
            {
                throw new ArgumentException("Either tag or album do not exist!");
            }

            return($"Tag {tag.Name} added to {album.Name}!");
        }