Esempio n. 1
0
 public string UpdateArtist(int aId, string Name)
 {
     AudioAlbumRepository audioAlbumRepository = new AudioAlbumRepository(new yslDataContext());
     AudioAlbum audioAlbum = audioAlbumRepository.getAudioAlbum(aId);
     ArtistRepository artistRepository = new ArtistRepository(new yslDataContext());
     Artist artist = artistRepository.getArtist(Name);
     audioAlbum.ArtistId = new int?(artist.ArtistId);
     audioAlbumRepository.updateAudioAlbum(audioAlbum);
     return "true";
 }
Esempio n. 2
0
 public ActionResult Processupload(string uploads)
 {
     string[] array = uploads.Split(new char[]
     {
         ';'
     });
     new AudioRepository(new yslDataContext());
     Request.Cookies.Get("ysl");
     int account = 1;
     string title = DateTime.Now.ToString("MMMM dd, yyyy");
     IAudioAlbumRepository audioAlbumRepository = new AudioAlbumRepository(new yslDataContext());
     new AudioAlbumItemRepository(new yslDataContext());
     AudioAlbum audioAlbum;
     if (audioAlbumRepository.AccountAudioAlbumExists(account, title))
     {
         audioAlbum = audioAlbumRepository.GetAccountAudioAlbumByTitle(account, title);
     }
     else
     {
         AudioAlbum a = new AudioAlbum
         {
             Created = DateTime.Now,
             Description = "",
             ArtistId = new int?(1),
             Title = DateTime.Now.ToString("MMMM dd, yyyy"),
             PhotoId = new int?(2),
             IsSingle = false,
             IsFeatured = false
         };
         int audioAlbumId = audioAlbumRepository.addAudioAlbum(a);
         audioAlbum = audioAlbumRepository.getAudioAlbum(audioAlbumId);
     }
     for (int i = 0; i < array.Length; i++)
     {
         if (!string.IsNullOrWhiteSpace(array[i]))
         {
             string[] array2 = array[i].Split(new char[]
             {
                 ','
             });
             string text = array2[0];
             text = text.Replace("/temp", "");
             string text2 = HostingEnvironment.MapPath(array2[0]);
             string destFileName = text2.Replace("\\temp", "");
             try
             {
              System.IO.File.Move(text2, destFileName);
                 Audio audio = new Audio
                 {
                     AccountId = 5,
                     Title = array2[1],
                     Description = "",
                     Location = text
                 };
                 EntitySet<AudioAlbumItem> arg_213_0 = audioAlbum.AudioAlbumItems;
                 AudioAlbumItem audioAlbumItem = new AudioAlbumItem();
                 audioAlbumItem.Audio = audio;
                 audioAlbumItem.Created = DateTime.Now;
                 audioAlbumItem.AudioAlbumId = audioAlbum.AudioAlbumId;
                 audioAlbumItem.Track = Math.Min(audioAlbum.AudioAlbumItems.Count + 1, audioAlbum.AudioAlbumItems.AsEnumerable<AudioAlbumItem>().Max((AudioAlbumItem s) => s.Track) + 1);
                 arg_213_0.Add(audioAlbumItem);
                 audioAlbumRepository.updateAudioAlbum(audioAlbum);
             }
             catch
             {
             }
         }
     }
     return base.RedirectToAction("ViewAlbum", new RouteValueDictionary(new
     {
         controller = "AudioController",
         action = "ViewAlbum",
         aid = audioAlbum.AudioAlbumId
     }));
 }
Esempio n. 3
0
 public ActionResult UpdateAlbumTitle(int aId, string Text)
 {
     AudioAlbumRepository audioAlbumRepository = new AudioAlbumRepository(new yslDataContext());
     AudioAlbum audioAlbum = audioAlbumRepository.getAudioAlbum(aId);
     audioAlbum.Title = Text;
     audioAlbumRepository.updateAudioAlbum(audioAlbum);
     JsonResult jsonResult = new JsonResult();
     jsonResult.Data ="success";
     return jsonResult;
 }
Esempio n. 4
0
        public ActionResult Processsingle(string meta, string uploads)
        {
            string[] array = uploads.Split(new char[]
            {
                ';'
            });
            string[] array2 = meta.Split(new char[]
            {
                '~'
            });
            new AudioRepository(new yslDataContext());
            base.Request.Cookies.Get("ysl");
            int value = 1;
            DateTime.Now.ToString("MMMM dd, yyyy");
            IAudioAlbumRepository audioAlbumRepository = new AudioAlbumRepository(new yslDataContext());
            new AudioAlbumItemRepository(new yslDataContext());
            IPhotoRepository photoRepository = new PhotoRepository(new yslDataContext());
            string text = array2[2];
            text = text.Replace("/temp", "");
            string text2 = HostingEnvironment.MapPath(array2[2]);
            string destFileName = text2.Replace("\\temp", "");
            int value2 = 0;
            try
            {
             System.IO.File.Move(text2, destFileName);
                value2 = photoRepository.addPhoto(new Photo
                {
                    AccountId = 5,
                    Location = text,
                    Title = "",
                    Description = ""
                });
            }
            catch
            {
            }
            AudioAlbum audioAlbum = new AudioAlbum
            {
                ArtistId = new int?(value),
                Title = array2[0],
                Description = array2[1],
                PhotoId = new int?(value2),
                IsSingle = true,
                IsFeatured = bool.Parse(array2[3])

            };
            int audioAlbumId = audioAlbumRepository.addAudioAlbum(audioAlbum);
            AudioAlbum audioAlbum2 = audioAlbumRepository.getAudioAlbum(audioAlbumId);
            string[] array3 = array;
            for (int i = 0; i < array3.Length; i++)
            {
                string text3 = array3[i];
                if (!string.IsNullOrWhiteSpace(text3))
                {
                    string[] array4 = text3.Split(new char[]
                    {
                        ','
                    });
                    text = array4[0];
                    text = text.Replace("/temp", "");
                    text2 = HostingEnvironment.MapPath(array4[0]);
                    destFileName = text2.Replace("\\temp", "");
                    var dLink = text;
                    if (!array2[4].Trim().Equals("autoGen"))
                        dLink = array2[4].Trim();
                    try
                    {
                     System.IO.File.Move(text2, destFileName);
                        Audio audio = new Audio
                        {
                            AccountId = 5,
                            Title = array2[0],
                            Description = array2[1],
                            Location = text
                        };
                        audioAlbum2.AudioAlbumItems.Add(new AudioAlbumItem
                        {
                            Audio = audio,
                            Track = audioAlbum.AudioAlbumItems.Count + 1,
                            AudioAlbum = audioAlbum,
                            DownloadLink = dLink
                        });
                    }
                    catch
                    {
                    }
                }
            }
            audioAlbumRepository.updateAudioAlbum(audioAlbum2);
            return base.RedirectToAction("Index");
        }