public IHttpActionResult PutMusic(int id, Music music) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != music.Id) { return(BadRequest()); } _db.Entry(music).State = EntityState.Modified; try { _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MusicExists(id)) { return(NotFound()); } throw; } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,FullName,ArtistType")] Artist artist) { if (ModelState.IsValid) { db.Entry(artist).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(artist)); }
public ActionResult Edit([Bind(Include = "Id,Title,Genre,ArtistId")] Album album) { if (ModelState.IsValid) { db.Entry(album).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ArtistId = new SelectList(db.Artists, "Id", "FullName", album.ArtistId); return(View(album)); }