Adding a REST method to the StoreManagerController for automation purpose.

Adding this action to get Id of an album given an album name.
This commit is contained in:
Praburaj 2014-05-27 17:29:19 -07:00
parent de955c6d90
commit b8782ee2bf
2 changed files with 10 additions and 9 deletions

View File

@ -22,8 +22,6 @@ namespace MusicStore.Controllers
//
// GET: /Checkout/
//Bug: https://github.com/aspnet/WebFx/issues/339
[HttpGet]
public IActionResult AddressAndPayment()
{
return View();

View File

@ -53,8 +53,6 @@ namespace MusicStore.Controllers
//
// GET: /StoreManager/Create
//Bug: https://github.com/aspnet/WebFx/issues/339
[HttpGet]
public IActionResult Create()
{
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name");
@ -86,8 +84,6 @@ namespace MusicStore.Controllers
//
// GET: /StoreManager/Edit/5
//Bug: https://github.com/aspnet/WebFx/issues/339
[HttpGet]
public IActionResult Edit(int id = 0)
{
Album album = db.Albums.Single(a => a.AlbumId == id);
@ -119,9 +115,6 @@ namespace MusicStore.Controllers
//
// GET: /StoreManager/Delete/5
//Bug: https://github.com/aspnet/WebFx/issues/339
[HttpGet]
public IActionResult Delete(int id = 0)
{
Album album = db.Albums.Single(a => a.AlbumId == id);
@ -143,5 +136,15 @@ namespace MusicStore.Controllers
db.SaveChanges();
return RedirectToAction("Index");
}
//
// GET: /StoreManager/GetAlbumIdFromName
// Note: Added for automated testing purpose. Application does not use this.
[HttpGet]
public int GetAlbumIdFromName(string albumName)
{
var album = db.Albums.Single(a => a.Title == albumName);
return album.AlbumId;
}
}
}