This project is read-only.

Manage Orders

Feb 1, 2011 at 5:26 PM
Edited Feb 1, 2011 at 5:46 PM

Hello. I am totally new to asp so my question might be stupid. I created new controller so I can browse/update/delete orders in my store. If someone purchase two or more items, it takes two rows in database to store data. When I am going to 'details' view I can only display one of the purchased items. When im trying to use foreach loop I am getting this error: "foreach statement cannot operate on variables of type 'ss.Models.OrderDetail' because 'ss.Models.OrderDetail' does not contain a public definition for 'GetEnumerator'". Any advice how can I display all the purchased items? I tried to use List view instead of Details but I failed.

I have one more problem here, 'Total' value is displaying correctly while checkout, but it is not saved into database unlike other values (NULL). Is it well known problem or just me?

I used v.1.0 Tutorial.

Sorry for my bad English, hope you can understand the text above. Thanks

Apr 13, 2012 at 7:45 PM
Edited Apr 13, 2012 at 8:04 PM

Hi Kruszyna, i had the same problem like you about Total attribute in order table or class :) i found solution. Before

DBCONTEXT.SaveChanges() in CreateOrder procedure, you have to put :

DBCONTEXT.Entry(order).State = System.Data.EntityState.Modified;