New answers tagged

0

It's a good practice to have a separate directory like "Services" or "Utilities". Then your MVC layers can use these functionalities. Project directory structure: - app/ - Models/ - Controllers/ - Views/ - Services/ - Mail/Mailer.php - Mail/MailTrap.php - Mail/AmazonSES.php - Sms/Provider.php - ...


1

Which of the following api calls is the proper usage of such a use-case? REST doesn't care what spelling you use for your resource identifiers. So you can choose any spelling you want. /api/users/{username}/polls /api/polls?username=xxx Both of these are fine. You get somewhat different trade offs: /api/users/{username}/polls -- here, you can use relative ...


2

If you keep it under the user controller it will be more cohesive. The user controller should serve all the operations needed for the user and one of them is getting user polls. It will make sense to have a polls controller when you have an independent use case for polls like getting polls statistics over all users.


0

There are many ways to do validation. No single way is correct. Application architecture and type of application make a big difference. The built-in validations with ASP.NET MVC work best with traditional web applications that return a form with a GET request, and redraw the form on POST-back if validation errors occur. Judging by the feedback in your pull ...


Top 50 recent answers are included