Using HttpNotFound helper in actions returning 404

This commit is contained in:
Praburaj 2014-08-12 11:44:48 -07:00
parent ca515e3e87
commit abd215a543
1 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ namespace MusicStore.Controllers
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.
@ -84,7 +84,7 @@ namespace MusicStore.Controllers
if (album == null)
{
return new HttpStatusCodeResult(404);
return HttpNotFound();
}
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);
if (album == null)
{
return new HttpStatusCodeResult(404);
return HttpNotFound();
}
return View(album);
}
@ -143,7 +143,7 @@ namespace MusicStore.Controllers
if (album == null)
{
return new HttpStatusCodeResult(404);
return HttpNotFound();
}
return new ContentResult { Content = album.AlbumId.ToString(), ContentType = "text/plain" };