コード例 #1
0
        public ArtistAlbum Create(ArtistAlbum ArtistAlbum)
        {
            var result = _context.Add <ArtistAlbum>(ArtistAlbum);

            _context.SaveChanges();
            return(result.Entity);
        }
コード例 #2
0
        public void Post(AlbumDTO value)
        {
            Album model = new Album()
            {
                Name        = value.Name,
                ReleaseYear = value.ReleaseYear,
                StudioId    = value.StudioId
            };

            IAlbumRepository.Create(model);
            for (int i = 0; i < value.ArtistId.Count; i++)
            {
                ArtistAlbum ArtistAlbum = new ArtistAlbum()
                {
                    AlbumId  = model.Id,
                    ArtistId = value.ArtistId[i]
                };
                IArtistAlbumRepository.Create(ArtistAlbum);
            }
            for (int i = 0; i < value.SongId.Count; i++)
            {
                SongAlbum SongAlbum = new SongAlbum()
                {
                    AlbumId = model.Id,
                    SongId  = value.ArtistId[i]
                };
                ISongAlbumRepository.Create(SongAlbum);
            }
        }
コード例 #3
0
        public ArtistAlbum Delete(ArtistAlbum ArtistAlbum)
        {
            var result = _context.Remove(ArtistAlbum);

            _context.SaveChanges();
            return(result.Entity);
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            ArtistAlbum artistAlbum = db.ArtistAlbums.Find(id);

            db.ArtistAlbums.Remove(artistAlbum);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
        public ArtistAlbum Post(ArtistAlbumDTO value)
        {
            ArtistAlbum model = new ArtistAlbum()
            {
                ArtistId = value.ArtistId,
                AlbumId  = value.AlbumId
            };

            return(IArtistAlbumRepository.Create(model));
        }
コード例 #6
0
 public ActionResult Edit([Bind(Include = "ArtistId,AlbumId")] ArtistAlbum artistAlbum)
 {
     if (ModelState.IsValid)
     {
         db.Entry(artistAlbum).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ArtistId = new SelectList(db.Artists, "Id", "Name", artistAlbum.ArtistId);
     return(View(artistAlbum));
 }
コード例 #7
0
        public ActionResult Create([Bind(Include = "ArtistId,AlbumId")] ArtistAlbum artistAlbum)
        {
            if (ModelState.IsValid)
            {
                db.ArtistAlbums.Add(artistAlbum);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ArtistId = new SelectList(db.Artists, "Id", "Name", artistAlbum.ArtistId);
            return(View(artistAlbum));
        }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "artistAlbumID,artistID,albumID")] ArtistAlbum artistAlbum)
 {
     if (ModelState.IsValid)
     {
         db.Entry(artistAlbum).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.albumID  = new SelectList(db.Albums, "albumID", "albumName", artistAlbum.albumID);
     ViewBag.artistID = new SelectList(db.Artists, "artistID", "artistName", artistAlbum.artistID);
     return(View(artistAlbum));
 }
コード例 #9
0
        public void Put(int id, AlbumDTO value)
        {
            Album model = IAlbumRepository.Get(id);

            if (value.Name != null)
            {
                model.Name = value.Name;
            }
            if (value.ReleaseYear != 0)
            {
                model.ReleaseYear = value.ReleaseYear;
            }
            if (value.StudioId != 0)
            {
                model.StudioId = value.StudioId;
            }
            IAlbumRepository.Update(model);
            if (value.ArtistId != null)
            {
                IEnumerable <ArtistAlbum> MyArtistAlbums = IArtistAlbumRepository.GetAll().Where(x => x.AlbumId == id);
                foreach (ArtistAlbum MyArtistAlbum in MyArtistAlbums)
                {
                    IArtistAlbumRepository.Delete(MyArtistAlbum);
                }
                for (int i = 0; i < value.ArtistId.Count; i++)
                {
                    ArtistAlbum ArtistAlbum = new ArtistAlbum()
                    {
                        AlbumId  = model.Id,
                        ArtistId = value.ArtistId[i]
                    };
                    IArtistAlbumRepository.Create(ArtistAlbum);
                }
            }
            if (value.SongId != null)
            {
                IEnumerable <SongAlbum> MySongAlbums = ISongAlbumRepository.GetAll().Where(x => x.AlbumId == id);
                foreach (SongAlbum MySongAlbum in MySongAlbums)
                {
                    ISongAlbumRepository.Delete(MySongAlbum);
                }
                for (int i = 0; i < value.SongId.Count; i++)
                {
                    SongAlbum SongAlbum = new SongAlbum()
                    {
                        AlbumId = model.Id,
                        SongId  = value.ArtistId[i]
                    };
                    ISongAlbumRepository.Create(SongAlbum);
                }
            }
        }
コード例 #10
0
        public ActionResult Create([Bind(Include = "artistAlbumID,artistID,albumID")] ArtistAlbum artistAlbum)
        {
            if (ModelState.IsValid)
            {
                db.ArtistAlbums.Add(artistAlbum);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.albumID  = new SelectList(db.Albums, "albumID", "albumName", artistAlbum.albumID);
            ViewBag.artistID = new SelectList(db.Artists, "artistID", "artistName", artistAlbum.artistID);
            return(View(artistAlbum));
        }
コード例 #11
0
        // GET: ArtistAlbums/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ArtistAlbum artistAlbum = db.ArtistAlbums.Find(id);

            if (artistAlbum == null)
            {
                return(HttpNotFound());
            }
            return(View(artistAlbum));
        }
コード例 #12
0
        public ArtistAlbum Put(int id, ArtistAlbumDTO value)
        {
            ArtistAlbum model = IArtistAlbumRepository.Get(id);

            if (value.ArtistId != 0)
            {
                model.ArtistId = value.ArtistId;
            }
            if (value.AlbumId != 0)
            {
                model.AlbumId = value.AlbumId;
            }
            return(IArtistAlbumRepository.Update(model));
        }
コード例 #13
0
        // GET: ArtistAlbums/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ArtistAlbum artistAlbum = db.ArtistAlbums.Find(id);

            if (artistAlbum == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ArtistId = new SelectList(db.Artists, "Id", "Name", artistAlbum.ArtistId);
            return(View(artistAlbum));
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: marcipsen/Bandcamp2OneDrive
        private void cmdInputFile_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = _configs.InputPath;
            DialogResult dialogResult = openFileDialog1.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                _inputFile       = openFileDialog1.FileName;
                tbInputPath.Text = _inputFile;
            }
            _artistAlbum = ArtistAlbum.GetArtistAlbum(_inputFile);

            _genre = cbGenres.SelectedItem.ToString();

            _converter = new Bandcamp2OneDriveConverter(_configs, _genre, _inputFile, _artistAlbum.Artist, _artistAlbum.Album);

            tbOutputPath.Text = _converter.GetFullOutputPath();
        }
コード例 #15
0
        public ArtistAlbum Delete(int id)
        {
            ArtistAlbum model = IArtistAlbumsRepository.Get(id);

            return(IArtistAlbumsRepository.Delete(model));
        }
コード例 #16
0
 public ArtistAlbum Update(ArtistAlbum ArtistAlbum)
 {
     _context.Entry(ArtistAlbum).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     _context.SaveChanges();
     return(ArtistAlbum);
 }
コード例 #17
0
        public ArtistAlbum Delete(int id)
        {
            ArtistAlbum artistAlbum = IArtistAlbumRepository.Get(id);

            return(IArtistAlbumRepository.Delete(artistAlbum));
        }