Using HttpNotFound helper in actions returning 404
This commit is contained in:
parent
ca515e3e87
commit
abd215a543
|
|
@ -41,7 +41,7 @@ namespace MusicStore.Controllers
|
||||||
|
|
||||||
if (album == null)
|
if (album == null)
|
||||||
{
|
{
|
||||||
return new HttpStatusCodeResult(404);
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO [EF] We don't query related data as yet. We have to populate this until we do automatically.
|
// TODO [EF] We don't query related data as yet. We have to populate this until we do automatically.
|
||||||
|
|
@ -84,7 +84,7 @@ namespace MusicStore.Controllers
|
||||||
|
|
||||||
if (album == null)
|
if (album == null)
|
||||||
{
|
{
|
||||||
return new HttpStatusCodeResult(404);
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name", album.GenreId);
|
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name", album.GenreId);
|
||||||
|
|
@ -117,7 +117,7 @@ namespace MusicStore.Controllers
|
||||||
Album album = db.Albums.Single(a => a.AlbumId == id);
|
Album album = db.Albums.Single(a => a.AlbumId == id);
|
||||||
if (album == null)
|
if (album == null)
|
||||||
{
|
{
|
||||||
return new HttpStatusCodeResult(404);
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
return View(album);
|
return View(album);
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +143,7 @@ namespace MusicStore.Controllers
|
||||||
|
|
||||||
if (album == null)
|
if (album == null)
|
||||||
{
|
{
|
||||||
return new HttpStatusCodeResult(404);
|
return HttpNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ContentResult { Content = album.AlbumId.ToString(), ContentType = "text/plain" };
|
return new ContentResult { Content = album.AlbumId.ToString(), ContentType = "text/plain" };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue