controller

When should you use Async Controllers in ASP.NET MVC?

懵懂的女人 提交于 2019-12-19 06:24:30
问题 Changing an ASP.NET MVC synchronous controller ( Controller ) to an asynchronous controller ( AsyncController ) seems like a trivial thing to do, but when should you do it? Should I just make every controller async irrespective of its actions? What are examples of operations that would be improved if used in an asynchronous controller? Taking the most trivial example: static html pages. So you have the most basic of controllers which simply returns a View from the Index action. Should this

When should you use Async Controllers in ASP.NET MVC?

女生的网名这么多〃 提交于 2019-12-19 06:24:16
问题 Changing an ASP.NET MVC synchronous controller ( Controller ) to an asynchronous controller ( AsyncController ) seems like a trivial thing to do, but when should you do it? Should I just make every controller async irrespective of its actions? What are examples of operations that would be improved if used in an asynchronous controller? Taking the most trivial example: static html pages. So you have the most basic of controllers which simply returns a View from the Index action. Should this

When should you use Async Controllers in ASP.NET MVC?

五迷三道 提交于 2019-12-19 06:23:25
问题 Changing an ASP.NET MVC synchronous controller ( Controller ) to an asynchronous controller ( AsyncController ) seems like a trivial thing to do, but when should you do it? Should I just make every controller async irrespective of its actions? What are examples of operations that would be improved if used in an asynchronous controller? Taking the most trivial example: static html pages. So you have the most basic of controllers which simply returns a View from the Index action. Should this

Magento: Select Customer Group at Registration

旧城冷巷雨未停 提交于 2019-12-19 03:12:45
问题 Trying to add a group_id radio button set in Magento Pro v1.11 Following along with http://phpmagento.blogspot.com/2012/01/how-to-show-customer-group-selecter-in.html and http://developersindia.info/magento/magento-override-frontend-controller.html, which is working to a point, but the group_id is not getting written to the db. my module, thus far: Directory Structure app/code/local - WACI -- Customer --- controllers ---- AccountController.php --- etc ---- config.xml config.xml <config>

Understanding dependency injection in AngularJS controllers

白昼怎懂夜的黑 提交于 2019-12-19 03:11:57
问题 Just learning dependency injection, and I think I'm starting to understand it. Please tell me if I'm on the right track... E.g.: Are these two equivalent? /* injection method */ function <controller_name>($scope) {} <controller_name>.$inject = ['$scope']; /* other method */ var app = angular.module('myApp'); app.controller(<controller_name>, function($scope) {}); 回答1: First a little clarification: For dependency injection, it doesn't matter whether you declare a controller using a global

Controller logic vs Service/Business layer logic

十年热恋 提交于 2019-12-19 02:47:41
问题 I am working on an application and am using a Repository-Service-Controller approach for a REST API. I find myself debating between controller logic vs service logic. The service logic deals with business logic, such as calculating a book price, and the controller logic should deal with presentation details. What if part of the business logic of the application is to check the publisher is subscribed to a PremiumService to determine if the book is editable? Would this go in business logic or

Magento override controller

我们两清 提交于 2019-12-19 02:47:14
问题 I would like to do the above. Ive overridden many files in the past...block, model, helper....but this one eludes me. Can anyone see what im doing wrong here: (ive edited this code...to include some of the recomendations now...) Heres my folder structure (2 controller locations as a test): /Idigital/Idgeneral/etc/config.xml /Idigital/Idgeneral/controllers/Checkout/CartController.php /Idigital/Idgeneral/controllers/CartController.php Heres my config.xml: <?xml version="1.0"?> <config> <modules

Extending Devise Registration Controller

ぐ巨炮叔叔 提交于 2019-12-19 02:47:11
问题 I have an Accounts model set up with Devise. Devise uses a few attributes (such as email, password etc.) but I have a few other attributes that I made. On sign up, I'd like to set them up in a way. How can I extend the registration controller? I understand that I need to actually create a new controller like this: class AccountsController < Devise::RegistrationController def create super end end Can I just add my code right after super ? I think it would be too late as the resource would have

MVC3 using CheckBox with a complex viewmodel

大憨熊 提交于 2019-12-18 18:23:09
问题 Right guys. I need your brains as I can't find a way to do this properly. I have a view model: public class EditUserViewModel { public User User; public IQueryable<ServiceLicense> ServiceLicenses; } User is unimportant as I know how to deal with it. ServiceLicenses has the following implementation: public class ServiceLicense { public Guid ServiceId { get; set; } public string ServiceName { get; set; } public bool GotLic { get; set; } } Getting a checked list of users is cool. It works like a

dynamically mapping roles to controllers in ASP.Net MVC

不问归期 提交于 2019-12-18 17:07:15
问题 I am currently hard coding the authorized roles in the filter in my MVC applications like so: [Authorize(Roles = "Administrator,Manager")] I'd like to eventually have a way to map the roles to each controller, so that the site admin can handle assigning what roles can perform each set of actions. string roles = DoSomethingToGetAllowableRoles(controllerName); [Authorize(Roles = roles)] I'm imagining that I need to have a database table that somehow keeps a listing of each controller, and then