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:
parent
de955c6d90
commit
b8782ee2bf
|
|
@ -22,8 +22,6 @@ namespace MusicStore.Controllers
|
||||||
//
|
//
|
||||||
// GET: /Checkout/
|
// GET: /Checkout/
|
||||||
|
|
||||||
//Bug: https://github.com/aspnet/WebFx/issues/339
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult AddressAndPayment()
|
public IActionResult AddressAndPayment()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,6 @@ namespace MusicStore.Controllers
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET: /StoreManager/Create
|
// GET: /StoreManager/Create
|
||||||
//Bug: https://github.com/aspnet/WebFx/issues/339
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name");
|
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name");
|
||||||
|
|
@ -86,8 +84,6 @@ namespace MusicStore.Controllers
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET: /StoreManager/Edit/5
|
// GET: /StoreManager/Edit/5
|
||||||
//Bug: https://github.com/aspnet/WebFx/issues/339
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Edit(int id = 0)
|
public IActionResult Edit(int id = 0)
|
||||||
{
|
{
|
||||||
Album album = db.Albums.Single(a => a.AlbumId == id);
|
Album album = db.Albums.Single(a => a.AlbumId == id);
|
||||||
|
|
@ -119,9 +115,6 @@ namespace MusicStore.Controllers
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET: /StoreManager/Delete/5
|
// GET: /StoreManager/Delete/5
|
||||||
|
|
||||||
//Bug: https://github.com/aspnet/WebFx/issues/339
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Delete(int id = 0)
|
public IActionResult Delete(int id = 0)
|
||||||
{
|
{
|
||||||
Album album = db.Albums.Single(a => a.AlbumId == id);
|
Album album = db.Albums.Single(a => a.AlbumId == id);
|
||||||
|
|
@ -143,5 +136,15 @@ namespace MusicStore.Controllers
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
return RedirectToAction("Index");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue