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

learn more… | top users | synonyms

2
votes
0answers
49 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 ...
0
votes
1answer
16 views

Is it reasonable to have separate controller actions for different user registration paths? Or should I refactor into a fewer number of actions?

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 ...
2
votes
3answers
93 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 ...
4
votes
1answer
80 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 ...
1
vote
1answer
50 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 Db<Sets>. It runs kinda slow, taking around 4 seconds to ...
0
votes
2answers
48 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> ...
3
votes
2answers
273 views

Loading content in page via jQuery

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? jQuery: // Another question here: how can I ...
0
votes
1answer
294 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
111 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
2answers
51 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
796 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
65 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
463 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
174 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
83 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
149 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
305 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 ...
2
votes
2answers
4k 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
146 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
80 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
305 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
144 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
4answers
3k 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
282 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
619 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 ...
4
votes
3answers
536 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 ...