public ArtistAlbum Create(ArtistAlbum ArtistAlbum) { var result = _context.Add <ArtistAlbum>(ArtistAlbum); _context.SaveChanges(); return(result.Entity); }
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); } }
public ArtistAlbum Delete(ArtistAlbum ArtistAlbum) { var result = _context.Remove(ArtistAlbum); _context.SaveChanges(); return(result.Entity); }
public ActionResult DeleteConfirmed(int id) { ArtistAlbum artistAlbum = db.ArtistAlbums.Find(id); db.ArtistAlbums.Remove(artistAlbum); db.SaveChanges(); return(RedirectToAction("Index")); }
public ArtistAlbum Post(ArtistAlbumDTO value) { ArtistAlbum model = new ArtistAlbum() { ArtistId = value.ArtistId, AlbumId = value.AlbumId }; return(IArtistAlbumRepository.Create(model)); }
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)); }
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)); }
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)); }
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); } } }
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)); }
// 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)); }
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)); }
// 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)); }
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(); }
public ArtistAlbum Delete(int id) { ArtistAlbum model = IArtistAlbumsRepository.Get(id); return(IArtistAlbumsRepository.Delete(model)); }
public ArtistAlbum Update(ArtistAlbum ArtistAlbum) { _context.Entry(ArtistAlbum).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(ArtistAlbum); }
public ArtistAlbum Delete(int id) { ArtistAlbum artistAlbum = IArtistAlbumRepository.Get(id); return(IArtistAlbumRepository.Delete(artistAlbum)); }