public async Task <IActionResult> PutArtistsAlbum([FromRoute] string id, [FromBody] ArtistsAlbum artistsAlbum) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != artistsAlbum.Title) { return(BadRequest()); } _context.Entry(artistsAlbum).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArtistsAlbumExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult DeleteConfirmed(string id) { ArtistsAlbum artistsAlbum = db.ArtistsAlbums.Find(id); db.ArtistsAlbums.Remove(artistsAlbum); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Get(int id) { ArtistsAlbum artistsAlbum = db.ArtistsAlbums.Find(id); if (artistsAlbum == null) { return(NotFound()); } return(Ok(artistsAlbum)); }
public ActionResult Edit([Bind(Include = "Title,Genre,Name_of_Song,Artist_name,Year_of_Release")] ArtistsAlbum artistsAlbum) { if (ModelState.IsValid) { db.Entry(artistsAlbum).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(artistsAlbum)); }
public ActionResult Put(int id, [FromBody] ArtistsAlbum artistsAlbum) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Entry(artistsAlbum).State = Microsoft.EntityFrameworkCore.EntityState.Modified; db.SaveChanges(); return(NoContent()); }
public ActionResult Post([FromBody] ArtistsAlbum artistsAlbum) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ArtistsAlbums.Add(artistsAlbum); db.SaveChanges(); return(CreatedAtAction("Post", artistsAlbum)); }
public ActionResult Create([Bind(Include = "Title,Genre,Name_of_Song,Artist_name,Year_of_Release")] ArtistsAlbum artistsAlbum) { if (ModelState.IsValid) { db.ArtistsAlbums.Add(artistsAlbum); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(artistsAlbum)); }
public async Task <IActionResult> PostArtistsAlbum([FromBody] ArtistsAlbum artistsAlbum) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ArtistsAlbums.Add(artistsAlbum); await _context.SaveChangesAsync(); return(CreatedAtAction("GetArtistsAlbum", new { id = artistsAlbum.Title }, artistsAlbum)); }
public ActionResult Delete(int id) { ArtistsAlbum artistsAlbum = db.ArtistsAlbums.Find(id); if (artistsAlbum == null) { return(NotFound()); } db.ArtistsAlbums.Remove(artistsAlbum); db.SaveChanges(); return(Ok()); }
// GET: ArtistsAlbums/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ArtistsAlbum artistsAlbum = db.ArtistsAlbums.Find(id); if (artistsAlbum == null) { return(HttpNotFound()); } return(View(artistsAlbum)); }