Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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".

2
votes
0answers
34 views

Retrieve file and other input fields from JavaScript to send to ASP.NET Core

I am currently developing an e-commerce website where users can upload their photos to customise their products. The use case begins when the user selects a product from our website (e.g. shirt). ...
4
votes
1answer
215 views

Codeigniter 3 micro-blogging application

I am working on a basic blog application in Codeigniter 3.1.8 and Bootstrap 4. The application allows Registration (as an author), Login, adding Categories and Posts. I have created an installation ...
2
votes
1answer
58 views

Table View Controller class in Swift

My TableView consists of four cells (for blacklisting categories) with a boolean property (indicated with a checkmark) and another cell with a UISwitch embedded in ...
1
vote
0answers
43 views

updatePositions() Laravel controller method

I have been trying to implement good 'OOP' and coding standards, but I always end up with bloated controllers. How could I clean this controller method? ...
4
votes
1answer
72 views

User controller for a .net core WebAPI dating app

I have this user controller that follows the repository pattern. It works perfect, but is it easy to understand? Is this good quality work? ...
0
votes
0answers
62 views

Forgot password / Reset password

I have a working example of 2 methods: Forgot password: A user inserts an account number and an email => An email is sent to the user right after it creates a token in the database. Validate Reset ...
1
vote
2answers
92 views

Validation and business logic for a form for milling jobs [closed]

I have the following BLL (Business Logic Layer) class. It is the first class I have created that takes away all responsibility from the UI (where this class is instantiated/created/called) in terms of ...
1
vote
0answers
152 views

React Native app screen for booking appointments

I've been building a two-sided (both clients and service providers would use the app) appointment booking app. This is a screen from which a service provider can confirm their profile after having ...
1
vote
0answers
61 views

Symfony controller to register and activate users

I've been in an interview some time ago. They objected my Symfony API code with following line: Too much code in controller actions. Can be moved to services to keep the business logic apart ...
1
vote
0answers
64 views

Laravel Controller function to return view based on user permission

I have one route that switches the routes based on the permission the user has. Here is a little example: ...
2
votes
1answer
73 views

Rails thin controller method to change account plan and fire slack message via a service object

I'm a beginner with Rails and am trying to figure out how to keep my controllers clean and thin, and how to work with service objects. I am building an internal tool to manage our SaaS customers, and ...
1
vote
1answer
124 views

JavaFX controller for a poker game

I am making a poker application in JavaFX. When I try to display the cards on the screen it is working perfectly fine. Yet I have a method with a lot of duplicated code in it. I have tried to ...
6
votes
3answers
5k views

ASP.NET REST controller with try-catch error handling

Yesterday someone guided me through this article and I'm wondering whether I should use try-catch implementation or not? I have the following code below which is actually a RESTful service and I have ...
3
votes
2answers
127 views

Rails controller for a vocabulary quiz

I'm new to refactoring and I have just refactored an old Rails project that had bloated controller methods. I spun off the bloated methods into its own separate controller following this logic, since ...
3
votes
2answers
92 views

Creating user accounts

I have a method which allows to create user account. It contains some conditions to control empty fields, wrong format of email, weak password, etc. ...
2
votes
0answers
45 views

Controller to execute AJAX requests for a client

I have been developing this structure or pattern (I don't really know how to call it). It's my first time doing something like this, and I'm a bit worried about the future, if it becomes unmanageable. ...
2
votes
1answer
88 views

Exporting documents from PostgreSQL into a second database

This is my first try with a database. I read some articles/books and now i tried it myself and I want to know if I can write it better or what are my mistakes. All in all I am using try/catch/finally, ...
3
votes
1answer
1k views

Laravel voting system

I have written a voting class in Laravel. It uses the voting sites API to check if the user has voted today. A user is only allowed to vote once every day. All votes reset at midnight (i.e. 12:00 AM ...
1
vote
1answer
640 views

Simple login with jsp

I made a simple login page with Java EE, jsp, servlet, tomcat and jdbc. It does following: login user register user after login it creates token for the session so ya can be directed from start page ...
2
votes
1answer
127 views

Codeigniter Controller for work orders

I'm working on a project and one of my controllers is getting quite large and hard to maintain or add to. I'm having trouble deciding what belongs in the controller and what I can move to the model. ...
1
vote
3answers
590 views

Laravel controller to manage sent and received messages

I write small inboxing app in Laravel 5.5 for my wesite. In inbox app users can compose new message, read messages and delete messages. I have only one table in my database for inboxes. Structure of ...
6
votes
1answer
73 views

Logging Window system

(I originally asked this on Stack Overflow and was directed here) So I have 2 classes, one is a PyQT window widget, and the other class is a stack which holds a dictionary pointing to all of the ...
1
vote
0answers
109 views

Laravel Model and Controller code interacation

I am trying to understand if I placed the function in the correct place. If someone could review it and suggest what I am doing wrong or right it would be appreciated. Personally I think I placed the ...
3
votes
2answers
354 views

Business logic inside MVC Cart Controller method

I have a controller method, invoked when a user adds the product he is viewing to the cart. The way I understand how MVC works, this can be considered a fat controller already, but I'm still not ...
1
vote
0answers
188 views

A rails controller needs to validate certain values exist

I need to pass some values from a CMS to a rails view. I should check these values are defined in the CMS. These values are meant to be use in all pages, hence the use of ...
4
votes
2answers
186 views

Request dispatcher for PHP JSON web service

Below you can find the constructor method and related fields of the main class of my REST API (note that the class contains more code than displayed) written in PHP 7.1. It does various things with ...
1
vote
1answer
5k views

Is this the right approach for Controller-Service-Dao implementation?

I am a bit confused with Controller Service Dao implementation . I created a dummy User servlet along with Model controller dao and a service , though it will work ,...
4
votes
0answers
110 views

Salesforce controller to implement a dynamic form

The code below is a controller for a Visualforce page (form). The controller determines if the form was previously created and saved or saved in progress in a previous action. If the form is new it ...
3
votes
2answers
43 views

Saves files and attachments regardless of errors in the model

I have a long form with dozens of fields, and users can upload photos and attachments in the form. It's super annoying when there is a simple field missing, the record doesn't save, and the user has ...
3
votes
1answer
845 views

Laravel LoginController

I have a LoginController in Laravel, but I think it could use some improving, can anyone tell me where I am going wrong? It just seems overall a bit messy, but I can't think of a logical way to ...
4
votes
0answers
451 views

Update UI once all API calls are done

I'm learning Swift at the moment but I would like to produce well-organised code. The goal of my little app is to display the weather of my current location. I use : the API of Darksky : https://...
2
votes
2answers
192 views

Laravel lumen : Post API method

Question is quite simple, I am using dingo package, Currently below is my code for an API call. ...
4
votes
1answer
2k views

Connect to MySQL and fetch a list of customers asynchronously using C#

I am connecting with a database and returning values from a Web API controller. For better performance, I am doing it completely asynchronously with a new task. Am I doing it the correct way? Am I ...
2
votes
1answer
79 views

Setting value of controller controls for domain objects with Reflection

Is my use of Java Reflection an OK design? Each domain object contains an annotation to declare what controller would be initialized to edit/create the object: Each field of the domain object has ...
7
votes
2answers
946 views

A controller on a .net core API

BACKGROUND I am working on a .Net Core API to drive a lyrics application. Users can sign up, submit artists & lyrics, and earn kudos / XP points in the process. Basically a community-driven ...
-1
votes
2answers
97 views

Practicing Java servlets, MySQL and JSON - follow-up

(See the previous iteration.) What's new I have incorporated all the points of Dmytro Maslenko's answer. My code seems a little bit tidier. Code AddPersonController.java ...
1
vote
1answer
527 views

Practicing Java servlets, MySQL and JSON

(See the next iteration.) Introduction This is my attempt at a simplistic web application just for the sake of practice. I have three main servlets: ...
1
vote
0answers
111 views

Designing better api controller

Overview I am designing one api that will be integration with another system, however I stumbled upon one code which I know it can be improved but I don't know how to do it properly. Code ...
3
votes
1answer
83 views

Defining routes and controllers relationship for given pages

I'm building a CMS app with the help of a custom framework. The back-office is composed of the following pages: post list page list user list post edit page edit user edit Actually, my routes are ...
0
votes
1answer
259 views

Communication to Child Controller

This is a simple AngularJs application with two nested controllers. We need to pass data from the parent to the child Controller. The first thing you find when googling for a solution would be this, ...
2
votes
1answer
175 views

MVC controller and action that handles favorite items in a session-based list

I've written a Controller and a corresponding Action for a Symfony 2.8 project, that does the following: handles a list of favorite items of a user the ids of the favorites are stored in the session ...
2
votes
1answer
849 views

Implementing delegate methods in an UIView class

This is my UIView class: ...
3
votes
1answer
154 views

Rails 5 controller to get information about Steam users

I've done a bit of modifications and finally got it working, and did a lot of reading about @ vs @@ vs just declaring and I came ...
2
votes
1answer
129 views

Initializing a controller that uses Selenium

I've outsourced the setup functions from my class to another file, I outsourced initDriver from the class PortalController to ...
1
vote
0answers
64 views

NodeJS controllers for a bus and a user

I'm writing my server and now I'm creating a controller for each route so I could use the same controller in different apis rather than rewrite the same code over and over. Below is my code example of ...
4
votes
1answer
811 views

Laravel - Revised Authentication Controller

I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see ...
5
votes
1answer
156 views

Email Controller

I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see ...
5
votes
1answer
524 views

Laravel - Authentication Controller

I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see ...
4
votes
1answer
804 views

REST API that allows creating/removing users, CRUD ToDo tasks

My project is supposed to be used as back-end for a simple to-do web app that lets you create an account, add, edit, complete, and delete todos. It could be used with some front end consumer like ...
-2
votes
1answer
62 views

How to optimize the below code in order to reduce the space and time to execute? [closed]

Am using the datasource which is from the MVC controller method "GetRepairIssues" in the client side to bind the options to the dropdownlist. The result comes as expected. I have to do it even better ...