Adding more albums to the SampleData.cs MVC 3 MusicStore

Oct 25, 2011 at 1:53 AM

I am trying to add more albums to the SampleData.cs class as well as change the picture to a new gif picture.  It changes in the class but when I rebuild it and run it again none of the changes are implemented on the website.

Is there a way of changing the info from the class itself without doing it on the website in the Storemanager page? 

Coordinator
Oct 29, 2011 at 6:48 PM

I'm not completely clear on what you're doing - are you just adding more albums without changing the data structure at all? If so, you can do that a few ways:

  • You should be able to add more items to SampleData.cs, but remember that the data in SampleData is only added if the data model changes or if the database doesn't exist. You can expand the App_Data folder and delete database file. The database will be created when you next run the app.
  • You can modify the data in the table using Visual Studio's data tooling - see Scott Guthrie's blog post, look for the part where it says "Step 4: Populate with data"
  • You can programatically add data - look at the controller code in StoreManager / Create - you can do the same thing in App_Start for a one-time data modification.
Oct 29, 2011 at 8:52 PM
I tried to expand the App_Data folder but to no avail. I would only open in Windows Explorer and there were 3 files:

ASPNETDB SQL SERVER Database Primary Data File
aspnetdb_log SQL Server Database Transaction Log File
and the musicstore sdf file

I could not delete the ASPNETDB at first but even when I was able to it did not apply the changes.

My primary goal was to add actual images for the album art. I added the images to the images folder and changed the file path in the SampleData.cs file and left the rest with the original placeholder.gif image. I am not sure what I did but when I originally changed about 10 of them in the SampleData.cs file, after playing around a bit they were changed. Now I have changed more and the images in the SampleData.cs file and when I run it the pictures are still the same placeholder images. I want to be able to add an album or update it from the SampleData.cs file as well as from the website.

Thank you for your time and help, it is greatly appreciated.


-----Original Message-----
From: jongalloway <notifications@codeplex.com>
To: nreid2701 <nreid2701@aol.com>
Sent: Sat, Oct 29, 2011 10:48 am
Subject: Re: Adding more albums to the SampleData.cs MVC 3 MusicStore [mvcmusicstore:277065]

From: jongalloway
I'm not completely clear on what you're doing - are you just adding more albums without changing the data structure at all? If so, you can do that a few ways:
  • You should be able to add more items to SampleData.cs, but remember that the data in SampleData is only added if the data model changes or if the database doesn't exist. You can expand the App_Data folder and delete database file. The database will be created when you next run the app.
  • You can modify the data in the table using Visual Studio's data tooling - see Scott Guthrie's blog post, look for the part where it says "Step 4: Populate with data"
  • You can programatically add data - look at the controller code in StoreManager / Create - you can do the same thing in App_Start for a one-time data modification.
To add a post to this discussion, reply to this email (mvcmusicstore@discussions.codeplex.com)
To start a new discussion for this project, email mvcmusicstore@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com