c# - Where to put the business logic for updating tables? -


where put createorder () business logic?

class order // entity model dbcontext {     public int id { set; get; }     public string name { set; get; } }  public void createorder(details details) {     // set order fields      database_name.order.add(order); } 

controller call obj.createorder(details);

would go in different class in app_code folder?

the answer question has been debated quite bit. depends on how want structure application. can see multiple viewpoints question here: mvc: put business logic?

i have seen applications createorder method part of model (in case order class).

i have seen lot of applications keep model clean possbile (poco classes, have) , put createorder method in business layer handles business specific rules, , createorder method in data layer handle commiting database.

some designs work better small applicaitons, while others work better more complex applicaitons.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -