开发者

ASP.NET MVC folder structure for E-Commerce project

I am little confused about the folder structure for my project and grouping them in Controller. Project is E-Commerce. I have pages like

Home,About,Contact,Category menu and SubCategory list page, ProductList, ProductDetail, ShoppingCart, CartSummary, Checkout

User management Edit Profile, Orders, login information management.

Admin Product management (Insert, Update, Delete, Upload images, Adding Description etc), Category management, Order management etc.

Should I mak开发者_JS百科e areas?. How to make clean folder structure.


My suggestion:

  • HomeController:
    • Home (Index action)
    • About
    • Contact
  • CategoryController:
    • Category (Index action - subcategory as a parameter of the category action)
  • ProductController:
    • List (you can share the productlist-html as a usercontrol with the category actions),
    • Detail
  • CartController:
    • ShoppingCart (Index action)
    • Checkout
    • Payment
    • ...
  • UserController:
    • Index (show the possible options: Edit and Orders)
    • Edit
    • Orders
  • Admin (Create a separate area for this because you will need multiple controllers to manage your site)
    • UsersController
    • OrdersController
    • ProductsController
    • SettingsController
    • MailingsController
    • ...


Areas is the way forward. Try making folder for each big feature you mentioned. And consolidate everything related to it inside one area including controllers, views, css, javascript etc.

Make one separate Shared folder which would contain the stuff common across the whole website eg master pages, jQuery files etc.


I'd suggest that ZippyV's solution layout is a good starting point for the solution. Depending on how you want to use IoC and unit testing etc. I'd potentially look at splitting out the controllers (and potentially model) into a separate project to aid in unit testing.

In addition to this I'd leave the admin section until you've defined all the objects / data structures you need for the public site otherwise you'll end up changing a model object and having to update in multiple places to potentially no gain (as it might change again :-)).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜