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".
0
votes
2answers
25 views
Codeigniter - in the view or in the controller?
Is this correct? Or am I overloading the responsibilities of the view?
<table class="table table-striped table-hover">
<thead>
<tr>
...
2
votes
1answer
50 views
Codeigniter: loading content in page via jQuery
Hi I'm doing a web site 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? Thanks.
jQuery
// Another question here, ...
0
votes
1answer
189 views
PHP MVC: how to do $_POST the right way
I am not sure if I am doing right on how to handle $_POST data in MVC pattern. Below is my attempt. Am I doing it right?
// Dummy $_POST data,
$_POST = array(
"menu" => array(
...
2
votes
1answer
90 views
is this producer-consumer implementation correct?
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 ...
1
vote
1answer
36 views
Can I make this admin method in CakePHP more streamlined?
I have a VenuesController and an EventsController. My venues controller has an admin_add method that, well, allows an administrator to add a venue to the database. It looks like this:
public function ...
2
votes
0answers
577 views
Review my 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 ...
1
vote
1answer
56 views
Cleanup controller action
I would like some help to clean up this action, especially from @companies and downward. The comments should be enough to explain :)
def search
@query = params[:query]
unless @query.blank?
...
1
vote
1answer
368 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 that will rather make simple to complex. That is why I did not consider creating one for my framework.
class ...
1
vote
1answer
43 views
Linq to sql performance
I'm creating a system and I'm using EF with Linq. Model First.
So I create my Model (.edmx) and using it, I generated my database and my classes. like the Usuario (user in portugues. going to keep ...
0
votes
2answers
172 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.
...
1
vote
1answer
72 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.
class PlanGpsController < ApplicationController
def index
@search = ...
0
votes
1answer
132 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 {
public $start_page = 'Dashboard' ; // Change to your home/default ...
4
votes
1answer
292 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 with the coding style I've adopted ...
1
vote
2answers
3k views
Search and Filter in MVC3 Razor I am using Linq, is there a better way to do this
Heres my Code and it works fine. I just dont like all the If else, what If I keep adding field to filter, its going to get messy. Ps: I am not using EF and cannot on this. Thanks.
CONTROLLER CODE
...
4
votes
1answer
143 views
How to improve this design?
I have some design doubts regarding my controllers and I would like some advice...
Everything works. However, I'd like to improve it.
Basically I have one controller per screen(Swing).
I have created ...
1
vote
2answers
76 views
How can I refactor this oversized Ruby method into smaller bits and have unit tests for them?
This is the existing code. Clearly way too much is going on in this index method and furthermore it's untested (and hard to test in its current form).
def index
# @s = ""
# @now=DateTime.now
...
4
votes
2answers
291 views
PHP MVC controller code needs diet?
This is the dashboard controller code in PHP Symfony 2. It collects some aggregate data and points for charts, but i don't like it very much. Do you think that this code belongs to what a controller ...
1
vote
2answers
135 views
Rails - Loading data in controllers
I am refactoring my controllers, trying to improve the way common data is loaded for the actions.
Initially I was using before_filter methods to do this but read that helper methods were preferred.
...
8
votes
5answers
2k views
How would you refactor this if statement of a Rails controller?
I first saw this gigantic if and tried to refactor it. Could only end with a endless switch statement.
Old code -
# It is a Cause
if @causality == "C"
@relationship.cause_id = @issueid
...
3
votes
1answer
276 views
Need help with cleaning up this Controller
I've written the following controller and i was looking for some input/advice on how i could go about cleaning this up or rewriting it. I feel like i'm repeating myself a lot or that there might be a ...
2
votes
2answers
607 views
Repetition in Controller code
In the index view a user can search with any combination of one to all of the following parameters: firstname, lastname or ssn. The found search results are displayed in the search results view. In my ...
3
votes
3answers
526 views
Not feeling 100% about my Controller design.
Basically, I'm uploading an excel file and parsing the information then displaying what was parsed in a view.
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.Mvc;
using ...