Adding Delete ActionResult (3)

Fortunately, Delete ActionResult after Post method has lines of code that nearly same with Edit ActionResult, but without assigning a new value.

The idea is searching for the same identity with database, then select the single song.

Song song = context.Songs.Where(some => some.Id == model.Id).Single<Song>();
context.Songs.DeleteOnSubmit(song);
context.SubmitChanges();
return RedirectToAction("Index");

results matching ""

    No results matching ""