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
2
votes
1answer
63 views

Controller in Laravel with parsing, creation and relationships

The following code represents the store method of a resource controller. A user can create an training offer on my website and can pass various information like ...
1
vote
0answers
33 views

Typescript Express - Controller in Controller via dependency Injection or logic in routes

I'm trying to give one Controller one operation. However, some Controllers exists of 2 or more operations. I'm not sure whats the best way to structure this part of the app. For example, I have 2 ...
1
vote
1answer
46 views

Passing argument to a constructor and using it only in some class methods

I've created some controller for handling clicked links statistics. Does this class meet Single Responsibility Principle? ...
1
vote
1answer
52 views

Decoupling of validation and data access in ASP.NET

I've been asigned to a project no dev has touched in a long time. It's an ASP.NET MVC 4 application. It appeared to be well coded, but had no testing and the database migration folder is not present. ...
3
votes
0answers
51 views

Controller class for an input dialog

I am learning OOP, concretely Java, by developing a real life business application for aimed for repair shops. I have followed MVC pattern design for GUI elements of my application. I was wondering do ...
3
votes
0answers
555 views

Symfony 4 controller with multiple forms

I have several pages in my app that have multiple forms. In this example, the 'account' page has 2 forms: allowing the user to change their password allowing the user to contact support I am new to ...
2
votes
1answer
34 views

Laravel controller methods for registering businesses and stylists

I use the Laravel API and want make messy code cleaner. I have a form for registering business and businessOwner. And stylist who is working under this business registering from same function. And ...
4
votes
0answers
77 views

Swift iOS app for showing motivational quotes, with multiple screens

I'm one month into self-learning Swift, and I would like some advice to improve my coding skills. I have listed 2 situations that I think I need to improve. I'd like some feedback focusing on my use ...
2
votes
0answers
53 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
281 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
117 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
48 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
153 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? ...
2
votes
2answers
100 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
520 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
251 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
79 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
74 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
218 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
10k 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
147 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
225 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
50 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
90 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
2k 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
977 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
149 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
909 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
86 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
122 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
435 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
203 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 ...
5
votes
2answers
248 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 ...
3
votes
1answer
7k 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
117 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
45 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
1k 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
560 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
223 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
89 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
1k 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
98 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
670 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
117 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 ...
5
votes
1answer
94 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
350 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
299 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
1k views

Implementing delegate methods in an UIView class

This is my UIView class: ...
3
votes
1answer
165 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 ...