0

I'm working on a pretty big project, which have insane ammount of methods in each controller. Same with Views, one folder contains about 150 .cshtml files, what makes this hard to explore. I wanted to create separate folder for each part of window, but that changes my routing adress from ./Tavern/Shop to /Views/Tavern/Tavern/Shop. Tavern controller have 3000+ lines of code, and even with (Ctrl+F) its hard to find and edit some functionality.

Any ideas how can i improve this without changing many files in solution?

3
  • for each part of window - maybe you should give us an idea about how the main page is composed of parts. Commented Jul 18, 2015 at 8:14
  • I take it a lot of domain logic is within your controller? Maybe you could start by identify it and pulling that out into a seperate layer to make it more manageable. That will make testing etc a lot easier. Commented Jul 18, 2015 at 8:17
  • @HenkHolterman One part is a Tavern views: shops, cooking, sleeping etc. Commented Jul 18, 2015 at 8:42

1 Answer 1

2

It is hard to help without viewing your code but these should be your guidelines:

  1. Controllers should be as 'skinny' as possible, all the code should be done in your BL layer. (external lib)

  2. Controller should be very specific - i.e. product, contact, home, etc...

  3. The routing is done via the controller, and not the location of the view - you can specify on your return View("~/AnyPath/GoesHere/AndTheRouting/IsTheSame.cshtml") (it will be controller/action) (or however you defined it in the routing.config)

  4. You can consider working with Areas.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.