Questions tagged [controller-actions]

10 questions
8
votes
3 answers

Should I make my ASP.NET MVC controller actions virtual?

File -> New Project for ASP.NET MVC projects used to generate controllers with virtual actions. I'm not sure if that stopped with MVC 2 or MVC 3, but is this no longer a best practice?
kenwarner
  • 28,650
  • 28
  • 130
  • 173
2
votes
2 answers

How do Rails' Controllers work?

1.) Is it possible to create a controller action that does not directly interact with a model? (i.e. upload a file to be parsed, then added to a DB model) 2.) What is the controller's order of operation? I don't understand how the controller action…
Utopia025
  • 1,181
  • 3
  • 11
  • 21
1
vote
2 answers

ASP.NET MVC selects the wrong controller action

I have a controller with two actions which have the same name, but one accepts some parameters. To disambiguate them, one accepts only GET requests, while the other accepts only POST requests. I also have an HttpAjaxAttribute which is used to…
Pawel Krakowiak
  • 9,940
  • 3
  • 37
  • 55
1
vote
2 answers

Access model in controller-action?

I'm editing an object with a form and want to save the changed object from within the controller-action which is bound to the submit-button. I don't want to bind the values directly to the template. Here's the admin/edit.hbs
Hedge
  • 16,142
  • 42
  • 141
  • 246
1
vote
2 answers

ASP.NET MVC View Issue when returning ActionResult from different Action

I have two ASP.NET MVC Actions: public ActionResult GetAll() { return GetOne(1); } public ActionResult GetOne(Int32 id) { return View(id); } As you can see, GetAll is calling the action GetOne. However, when GetAll() is called…
Alex
  • 75,813
  • 86
  • 255
  • 348
1
vote
1 answer

Creating actions and routes for tags and categories

I'm creating a blog for myself with Rails 3.2.5, and am trying to handle tags and categories properly. I want to allow the user to click on a link_to with the tag name that brings them to other entries with the same tag and have the URL be…
0
votes
3 answers

How can I access the args on the RESTful URL from a Controller?

I asked a preliminary and somewhat similar question here. Now I need to know how to access the values from within a RESTful URL inside a Controller method/action. I have a Controller named PlatypusController with a route for it set up like this in…
0
votes
2 answers

why would i get a different views when called from different controller actions in asp.net-mvc

I have 2 different controller actions. As seen below, one calls the same view as the other one. The fitness version has a bunch of jquery ui tabs. public ActionResult FitnessByTab(string tab, DateTime entryDate) { return…
leora
  • 188,729
  • 360
  • 878
  • 1,366
0
votes
1 answer

Rails4: creating and editing an object, through its association to another object, to a form_for helper

I have 2 models that are associated with each other via a join table: class Book < ActiveRecord::Base has_many :reviews has_many :readers, through: :libraries end class Reader < ActiveRecord::Base has_many :reviews has_many :books,…
Uzzar
  • 705
  • 1
  • 12
  • 24
0
votes
2 answers

Best practice for controller actions for changing state of model

I have a controller with the normal CRUD actions for a resource called "Issue". The Issue table has a boolean called published to save the state of each instance. When an issue gets the published boolean set to true, all the other instances of Issue…
jhummel
  • 1,724
  • 14
  • 20