Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [controller]

In MVC architecture (Model-View-Controller), the object responsible for passing and receiving data to and from views, acting as a bridge between the "Model" and the "View".

Filter by
Sorted by
Tagged with
3 votes
1 answer
150 views

Django view and template for a virtual zoo

I have a Django view and template that work together, but I think I probably did things in a crappy way. I basically have many dynamic values that I want to display on the page, and in two different ...
skaz's user avatar
  • 211
1 vote
1 answer
153 views

eCommerce web appliation

I am making an eCommerce web application using the Laravel 5 framework. I have created a Categories controller for the administrator and with the following actions ...
Saiyan Prince's user avatar
6 votes
2 answers
161 views

Controller for classrooms and students

The actions I'm wondering about are members, add_student, and remove_student. They work ...
Rob Sobers's user avatar
0 votes
1 answer
40 views

updateBuildChart method with a lot of dependencies

I've some refactoring issue with one method. This method has a lot of dependencies ...
Viktor's user avatar
  • 181
1 vote
1 answer
99 views

Adapting new design pattern with post handler

I'm currently using this pattern in my JavaScript code. Somewhere in my code I use Dnianas.Post.init. init fires and it will ...
Akar's user avatar
  • 339
5 votes
1 answer
148 views

Is my blog controller too "Fat"?

I would like some advice which relates to the "fat model skinny controller" concept in Rails. See my show action in the Micropost controller ...
GhostRider's user avatar
6 votes
1 answer
193 views

Controller to manage athletes

I would appreciate if you could give me some advice about the code below. I am a student learning PHP programming and programming fundamentals. I have learned a lot from Stack Overflow but there are ...
Kalpa Perera's user avatar
2 votes
1 answer
769 views

Web API controller to get details of a travel plan or a leave request

My web API has 3 controllers for get, post and users CRUD. I named it as DetailsControllor, FormControllor and ...
Rohi's user avatar
  • 21
2 votes
0 answers
68 views

Sports statistics controller

Is there too much logic in this controller (should I migrate them to the model)? How else can it be refactored? ...
j.hwang's user avatar
  • 21
2 votes
1 answer
498 views

Handling callbacks when doing async programming and dealing with scope

I'm using HapiJS to create a little backend for my side-project. In grabbing RSS feeds, I want to loop through my list of website URLs, grab the correct RSS links in the ...
program247365's user avatar
3 votes
1 answer
103 views

Using one service ($http) on all the controllers

I have recently started working on angular.js and I like it. I have decided to use a single controller per view. I use the json data from the backend. As my work is progressing, my codes are getting ...
Thomas Sebastian's user avatar
2 votes
1 answer
10k views

Shopping cart application in Spring MVC

I am creating a shopping cart application to learn Spring MVC. I want to display a list of all categories and subcategories in more than one page. i.e; Home Page, Products page, and Category page. In ...
Sai Upadhyayula's user avatar
2 votes
1 answer
479 views

Controller for repository of members

I tried to implement the Repository pattern for my project: MemberController.php -- this one is a bit too long and has repetitive code ...
topher's user avatar
  • 599
5 votes
1 answer
849 views

AngularJS trivia game - separating controller from directive

I am creating a trivia game (purely for learning purposes) using AngularJS, NodeJS and MongoDB. My concern is related to the way I am organising the code in AngularJS. So far the game is functional, ...
Roco CTZ's user avatar
  • 153
7 votes
1 answer
123 views

Controller action to process orders and payments

I'm trying to reduce the if statements and simplify this create action. ...
mnort9's user avatar
  • 241
2 votes
0 answers
50 views

Is my controller for editing information about videos doing too much?

My project uses Zend Framework 2. I'm trying to determine if I am doing too much in my controller as a rule for my development. I have built my controllers like this for a while and haven't run into ...
nathanjosiah's user avatar
9 votes
2 answers
5k views

Rails controller method that conditionally filters results

This code for my blog checks to see if tags are in the params hash. If they are, then only posts that are tagged will be paginated. Otherwise, all of the posts are paginated. ...
Dylan Richards's user avatar
5 votes
1 answer
33k views

Developing an alert notification in AngularJS

I'm studying Angular and want to develop my own notification alert. This is what I done, I like it and it's working like a charm but I think that it can be improved: Do I need to use it in conduction ...
Thales P's user avatar
  • 153
2 votes
1 answer
138 views

Any improvements for my LoginController class?

This is probably going to be my final question regarding controllers. I feel like I have a good enough understanding of them now and am able to write them cleanly. I've recently adapted a less error ...
Kid Diamond's user avatar
  • 2,591
3 votes
1 answer
420 views

Controller code using the koa framework

I would like to gather ideas on how to refactor the JavaScript/NodeJS controller code below to be more aesthetic. The code is using the koa framework thus I use ...
xpepermint's user avatar
15 votes
2 answers
528 views

My final sign up controller

I've asked a couple of questions here before regarding my controller, but I think I've finally gotten to understand controllers completely, but I'll never be sure unless I get my code reviewed. I've ...
Kid Diamond's user avatar
  • 2,591
-2 votes
3 answers
577 views

Setting up tab bar, navigation, and view controllers in iOS

I am new to iOS development. I wrote this code, but the company said that this is bad architecture and is not acceptable. I want to improve this code. ...
Hitesh Nalamwar's user avatar
4 votes
1 answer
84 views

Is this approach correct when testing an Angular controller?

I'd like someone to review these tests to make sure I'm along the right lines in Angular testing. Note - They do all pass (great) but I feel like I'm struggling to understand the finer points of ...
Katana24's user avatar
  • 327
3 votes
2 answers
135 views

Controller: Sign up action clean up

I don't know if it's just me, but I feel like my sign up action method has gotten a bit messy. I think that perhaps instead of setting error messages in a controller, I should set error codes which I ...
Kid Diamond's user avatar
  • 2,591
14 votes
2 answers
8k views

AngularJS Todo List - too much controller logic?

I am starting an angular app and I was wondering if I am on the right track with this. I worked on my last angular app when I was just a youngun who didn't understand the important of designing the ...
evwill's user avatar
  • 143
6 votes
1 answer
123 views

Uploading file for related entity

I see that my code smells. The first file is a controller, and createAction. But I don't know where to delegate this. BookController.php - Whole controller class So this is most 'smelly' code to ...
matiit's user avatar
  • 61
1 vote
1 answer
129 views

.ASP controller code

I've tried to create application with MVC N-layer pattern. I asked my buddy for a shot review, and he said, "You should separate logic from controller". But my controller only work as a ...
nuclear sweet's user avatar
3 votes
2 answers
150 views

Xerox Parc MVC implementation

I've been trying to understand the original MVC implementation (the Xerox Parc's one). I'm sure it has flaws, but it's simple code to practice/learn the original MVC. Working example View (index....
Thom Thom Thom's user avatar
2 votes
1 answer
4k views

CodeIgniter maintain data through Controllers

I have a main menu in my application. It loads depending on the role of the user that I validate from a table in my data base, but I have to recreate this menu every time I call a new controller. ...
AndreFontaine's user avatar
3 votes
1 answer
214 views

What can I do better in this ViewModel Creator?

I'm currently creating a ASP.NET MVC page in C#. I want to hide everything regarding the creation of our "models" and "viewmodels". I have seen much of the fancy stuff regarding Dependency ...
Carl Palsson's user avatar
0 votes
1 answer
166 views

Employer registration

I have two registration paths in my app. They are very similar and I am curious if I should simplify 4 associated actions down into two actions that handle the same amount of work. Here are my ...
Ecnalyr's user avatar
  • 413
3 votes
3 answers
3k views

Controller with too many dependencies?

The main impetus for this review is to determine if my ASP.NET Web API controller has too many dependencies. I'm of the opinion that 3-4 is okay, but 6 seems like too many. I have many controllers ...
mo.'s user avatar
  • 245
14 votes
2 answers
38k views

Using a BaseController in MVC asp.net to reuse the repository

I have a repository class that impliments a repository Interface. In my Controllers I want a way to access the repository without creating constructors each time in the controller. So now all my ...
Stone Temple Aviators's user avatar
1 vote
1 answer
603 views

Inserting using multiple contexts into LocalDB

I've written this ActionResult to model an Order that goes through. I couldn't think of another way to write this without using context ...
GivenPie's user avatar
  • 111
0 votes
2 answers
2k views

Codeigniter - in the view or in the controller?

Is this correct? Or am I overloading the responsibilities of the view? ...
AndreFontaine's user avatar
3 votes
2 answers
5k views

Loading content in page via jQuery

I'm doing a website in CodeIgniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it? jQuery: ...
AndreFontaine's user avatar
1 vote
1 answer
497 views

An account activation class

I'm rewriting a god object with long methods into something much more viewable and pretty. However, I think there is something missing and can be done better. I'm sending examples of one controller ...
user190839's user avatar
1 vote
1 answer
4k views

Doing $_POST the right way

I am not sure if I am correctly handling $_POST data in MVC pattern: Dummy $_POST data ...
Run's user avatar
  • 173
2 votes
1 answer
302 views

Controller for a MUD client

I want to ensure that, as much as possible given my skill level, that I'm using relevant patterns correctly and following naming conventions. This is a controller for a poor-mans MUD client using ...
Thufir's user avatar
  • 379
3 votes
2 answers
190 views

Admin method in CakePHP to add a venue to the database

I have a VenuesController and an EventsController. My venues controller has an admin_add ...
Martin Bean's user avatar
11 votes
1 answer
10k views

Generic ASP.NET MVC controller that generates many pages

I recently set out to create an open-source ASP.net MVC web development framework. Specifically, I wanted to automate some of the tasks associated with the creation of data-driven applications. I've ...
Vivian River's user avatar
1 vote
1 answer
166 views

Controller method to do fuzzy search for companies

I would like some help to clean up this action, especially from @companies and downward. The comments should be enough to explain :) ...
Frexuz's user avatar
  • 113
0 votes
1 answer
4k views

Counting failed login attempts to enforce temporary lockout

I'm reviewing my code and trying to figure out how I can do some simplifying to flatten my code. Whether it be making simpler function out of the segment of code or by removing parts of it and wanted ...
Kevin Smith's user avatar
2 votes
1 answer
2k views

Router Class In a Lightweight MVC Boilerplate

I'm trying to come up with a simple router class. I considered using a Request class, but I think that will turn something simple into something overly complex. ...
Joey Hipolito's user avatar
1 vote
1 answer
96 views

Linq to sql performance

I'm creating a system and I'm using EF with Linq. I create my Model (.edmx) and using it, I generated my database and my classes. Like the Usuario (user in Portuguese going to keep the names in ...
Michel Ayres's user avatar
0 votes
2 answers
250 views

How could I make my controller a little less hideous?

I have a controller. It functions as follows: A user imports a file and decides whether the files contents contain new entries to be placed into a database, or existing entries entries to be updated. ...
SamuelDavis's user avatar
1 vote
1 answer
116 views

Duplicate SQL code in controller

How I can rewrite or refactor my controller code? I have the same SQL query (@plan_gp_users) in all defs. ...
Sergey Chechaev's user avatar
0 votes
1 answer
313 views

Review: Finished router class for custom mini framework

I have finished my router and would like your thoughts on anything that may be inefficient of could be done better!: class Router { ...
imperium2335's user avatar
7 votes
2 answers
169 views

Action based controller using reflections

I'm modeling a reflection-based controller. I would like to know if you agree with my implementation and about what could be enhanced. I'm starting with reflection and I would like to know if I'm ...
user1618606's user avatar
4 votes
1 answer
521 views

Code structure for a login modal dialog.

I'm using twitter mobile and I have a login-dialog. login-Dialog is a modal dialog. To call it the user calls loginDialog.show(); I'm not all that comfortable ...
JonWells's user avatar
  • 323