Пример #1
0
        public ActionResult AddTrackToAlbum(Guid albumId, string TrackTitle, string ArtistName, string ArtistAlreadyInSpotify, string ArtistSpotifyUrl, DateTime ReleaseDate, string Genre, string CopyrightClaimerName, string AuthorName, string ComposerName, string ArrangerName, string ProducerName, string AlreadyHaveAnISRC, string ISRC_Number, string PriceTier, string ExplicitContent, string IsTrackInstrumental, string LyricsLanguage, string TrackZipFileLink, string ArtWork_Link)
        {
            List <string> mandetoryFieldsInput = new List <string> {
                TrackTitle, ArtistName, Genre, CopyrightClaimerName, AuthorName, ComposerName, ArrangerName, ProducerName, PriceTier, TrackZipFileLink, ArtWork_Link
            };
            List <string> mandetoryBoolFields = new List <string> {
                ArtistAlreadyInSpotify, AlreadyHaveAnISRC, ExplicitContent, IsTrackInstrumental
            };

            logic = new GeneralLogics();

            if (!logic.ContainsAnyNullorWhiteSpace(mandetoryFieldsInput))
            {
                if (!logic.ContainsAnyNullorWhiteSpace(mandetoryBoolFields))
                {
                    bool isArtistOnSpotify = false, isTrackHasISRC = false, isTrackHasExplicitContent = false, isTrackInstrumental = false;
                    if (ArtistAlreadyInSpotify == "yes")
                    {
                        isArtistOnSpotify = true;
                    }
                    if (AlreadyHaveAnISRC == "yes")
                    {
                        isTrackHasISRC = true;
                    }
                    if (ExplicitContent == "yes")
                    {
                        isTrackHasExplicitContent = true;
                    }
                    if (IsTrackInstrumental == "yes")
                    {
                        isTrackInstrumental = true;
                    }

                    if ((isArtistOnSpotify && !String.IsNullOrWhiteSpace(ArtistSpotifyUrl.Trim())) || (isArtistOnSpotify == false && String.IsNullOrWhiteSpace(ArtistSpotifyUrl.Trim())))
                    {
                        if ((isTrackHasISRC && !String.IsNullOrWhiteSpace(ISRC_Number.Trim())) || (isTrackHasISRC == false && String.IsNullOrWhiteSpace(ISRC_Number.Trim())))
                        {
                            if ((isTrackInstrumental && String.IsNullOrWhiteSpace(LyricsLanguage.Trim())) || (isTrackInstrumental == false && !String.IsNullOrWhiteSpace(LyricsLanguage.Trim())))
                            {
                                if (ReleaseDate != null && ReleaseDate > logic.CurrentIndianTime())
                                {
                                    //Code to add the song to the album
                                    businessLogics = new BusinessLogics();
                                    var result = businessLogics.CreateNewTrackForAlbum(albumId, TrackTitle, ArtistName, isArtistOnSpotify, ArtistSpotifyUrl, ReleaseDate, Genre, CopyrightClaimerName, AuthorName, ComposerName, ArrangerName, ProducerName, isTrackHasISRC, ISRC_Number, Convert.ToInt32(PriceTier), isTrackHasExplicitContent, isTrackInstrumental, LyricsLanguage, TrackZipFileLink, ArtWork_Link);
                                    if (result == 1)
                                    {
                                        return(RedirectToAction("ShowIndividualAlbumSongs", "Album", new { albumId = albumId }));
                                    }
                                    else if (result == 7)
                                    {
                                        TempData["ErrorMsg"] = "Your purchase has expired. you can't add the track to the album.";
                                    }
                                    else if (result == 8)
                                    {
                                        TempData["ErrorMsg"] = "You can't add the track as the album is full.";
                                    }
                                    else
                                    {
                                        TempData["ErrorMsg"] = "Internal Error occured";
                                    }
                                }
                                else
                                {
                                    TempData["ErrorMsg"] = "Provide a valid Date to release your track";
                                }
                            }
                            else
                            {
                                TempData["ErrorMsg"] = "If it's an instrumental track then leave the Lyrics Language field empty";
                            }
                        }
                        else
                        {
                            TempData["ErrorMsg"] = "If you have ISRC number for the track then select yes and provide the number. Otherwise select no and leave the field empty.";
                        }
                    }
                    else
                    {
                        TempData["ErrorMsg"] = "If artist is already on spotify then select yes and provide the link of the artist. Otherwise select no and leave the field empty.";
                    }
                }
                else
                {
                    TempData["ErrorMsg"] = "Select proper options from dropdowns";
                }
            }
            else
            {
                TempData["ErrorMsg"] = "Mandetory Fields can't be left empty";
            }
            return(RedirectToAction("AddTrackToAlbum", "Solo", new { albumId = albumId }));
        }