Where would I put the CreateOrder () business logic?
class Order // this is an entity model for DbContext
{
public int Id { set; get; }
public String name { set; get; }
}
public void CreateOrder(Details details)
{
// set up Order fields
database_name.Order.Add(order);
}
Controller would call obj.CreateOrder(details);
Would it go in a different class in the App_Code folder?
The answer to this question has been debated quite a bit. It all depends on how you want to structure your application. You can see multiple viewpoints to this question here: MVC: Where to put business logic?
I have seen applications where the CreateOrder method would be part of the Model (in this case the Order class).
I have also seen a lot of applications that keep the Model as clean as possbile (POCO classes, as you currently have) and would put the CreateOrder method in a Business Layer that handles any business specific rules, and another CreateOrder method in a Data Layer that would handle actually commiting it to the database.
Some designs work better for small applicaitons, while others work better for more complex applicaitons.