model-view-controller

Log out button not working in mvc application

江枫思渺然 提交于 2019-12-22 13:55:36
问题 I have an MVC application with different user accounts and passwords. The log in feature works fine, but when I click the log out button I get a 404 error saying: Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had >its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled >correctly. Requested URL: /Account/LogOff

Routing Error - No route matches [POST] for new

折月煮酒 提交于 2019-12-22 12:21:11
问题 I'm getting an error with routes and I can't find where is the problem, I'm creating a simple CRUD and get this trouble with the create method. Error No route matches [POST] "/usuarios/new" Controller def new @usuario = Usuarios.new end def create @usuario = Usuarios.new(params[:usuario]) if @usuario.save redirect_to usuario_path, :notice => "Cadastrado realizado com sucesso!" else render "new" end end new.html.erb <h1>Add new user</h1> <%= form_for (:usuario) do |f| %> <p> <%= f.label :name

Storing Editor Templates in external library

佐手、 提交于 2019-12-22 11:29:11
问题 Is it possible to create Editor Templates in an external library so that they can be shared between applications? I'm not looking to store cshtml files in a library, just wondering if there was a way you can create them and store them like you do with html helpers. There are a few that i use quite a lot and it would be nice to have them all in a single library to reference. 回答1: MVCContrib Portable Areas offers this functionality. Out of the box there is nothing built-in. You will need to

MVC Post values using ajax when value selected in dropdownlist

落花浮王杯 提交于 2019-12-22 11:28:19
问题 I have several dropdownlists in a form. Each time the user selects a value in one of these dropdownlist do I want the value to be saved to the backend (database). I don't want to page to reload so I guess the best way to achive this is with ajax, and this is what I need help with. How would I go about to get it to automaticly post the value to the server side when I select a value in a dropdownlist. Should I make 1 form for each of the drop down lists so I can update them individually? How do

ASP.NET MVC - Job of Controllers

做~自己de王妃 提交于 2019-12-22 10:54:53
问题 I think I'm beginning to be confused with the job of a controller in MVC. I have a service that exposes five functions: list packages in queue get package delete package accept package deny package My ASP.NET MVC controller depends on this service, and can generally execute a service call on an Action. I'm happy so far. The second part is then building the ViewModel result. If I do this inside of the controller, the controller now has an exploding dependency list -- each action added

RequireJS: How to define a constructor?

大兔子大兔子 提交于 2019-12-22 10:48:20
问题 I want to create constructors according to the AMD specification. I found this answer and tried to follow it. Here's what I ended up with: main.js requirejs.config({ paths: { 'jquery': 'vendor/jquery-1.9.1.min', 'lodash': 'vendor/lodash-1.3.1.min', 'knockout': 'vendor/knockout-2.2.1.min', 'bootstrap': 'vendor/bootstrap-2.3.2.min' } }); requirejs( ['jquery', 'lodash', 'knockout', 'controller/categories'], function main($,_,ko, CategoriesCtrl) { var categories = new CategoriesCtrl(); } );

Qt what needs to be done for a custom model to enable drop?

怎甘沉沦 提交于 2019-12-22 10:37:09
问题 I'm trying to enable drop on a custom model I have hooked up to QTreeView . I've done the following: Ensured that acceptDrops is enabled on the QTreeView Implemented on my custom model supportedDropActions to return Qt::CopyAction | Qt::MoveAction Implemented on my custom model mimeType s to return a QStringList with text/uri-list Implemented on my custom model dropMimeData to handle the drop if it ever occurred. This is all I needed to get it working on a QTreeWidget . I've gone on to:

Building a WinForms Application using MVC and Ninject as IoC Container

久未见 提交于 2019-12-22 09:59:26
问题 I am having to re-write a large WinForms application and I want to use MVC to allow increased testing capability etc. I want to also adopt Ninject as my IoC container as it is lightweight, fast and will increase the exstensibility of my application going forward. I have done a great deal of reading and I have managed to make a start on the arcitecture of this new application. However, I am not sure i have the right idea when using Ninject. The code... Starting with Program.cs and related

Why is the MVC paradigm best suited for web applications?

为君一笑 提交于 2019-12-22 09:57:17
问题 I'm fairly certain my professor will ask me why I chose to use MVC for my web application. Truth be told, I'm new to MVC. I read about it, I'm building a blog application using it, I think it's very logical to approach a problem this way. But why? O_O I draw a blank. How is better suited than say, building an N-tier application? 回答1: Well, basically: separation of concerns on the usage level, not the physical level. Quoting PoEAA on MVC MVC splits user interface interaction into three

AngularJs if statement in ng-href

泪湿孤枕 提交于 2019-12-22 09:45:34
问题 I have some elements which are created dynamically and every element has a different ng-href. I want to give different link according to some elements. When I try to write function in ng-href it sends the page to function in url,therefore it does not work. I try to do something like this; ....... <a ng-href='if(m){#linkOne} else {#linkTwo}' ng-click='test(type);'> </a> ....... Which method should i use to create element with different ng-href? 回答1: You can try this <a ng-href="{{m ? '#linkOne