Fixing a bug in the sample

When creating a new album an album is not generated - resulting in records being created with Id = 0.
This commit is contained in:
Praburaj 2014-05-09 21:16:06 -07:00
parent 38c5f0c514
commit 50c9a1de51
2 changed files with 7 additions and 1 deletions

View File

@ -68,6 +68,12 @@ namespace MusicStore.Controllers
{
if (ModelState.IsValid)
{
// TODO [EF] Swap to store generated identity key when supported
var nextId = db.Albums.Any()
? db.Albums.Max(o => o.AlbumId) + 1
: 1;
album.AlbumId = nextId;
db.Albums.Add(album);
db.SaveChanges();
return RedirectToAction("Index");

View File

@ -1,2 +1,2 @@
KRE_VERSION=0.1-alpha-build-0400
KRE_VERSION=0.1-alpha-build-0420
KRE_FLAVOR=CORECLR