model-view-controller

Dal (with Entity Framework) and Model layers into MVC

痞子三分冷 提交于 2019-12-30 11:24:08
问题 First of all , I use EF into Dal layer (separeted project from MVC, same solution). The generated models from EF's EDMX file are the actual models from Model layer?? If so, how do I access these models to work in MVC's View layer? I think it's wrong accessing data layer directly from view to work with these models, and If I make a Model layer with "my models" and translate Dal's models into mine models... it'll be duplicated code. Probably I'm getting something wrong, but most of egs. are

Where should validation take place?

霸气de小男生 提交于 2019-12-30 11:07:51
问题 I want to use MVC pattern in my PHP project. I also want to use Dao-Service pattern for Model layer since it makes database engines easily interchangeable and keeps business logic out of DB interaction. Now, I heard that validation should happen in Model layer since Controllers are only responsible for transporting data. That's pretty reasonable. Should it, however, be implemented in Service layer, or entities themselves? Approach 1: validation in entities class Post extends Entity {

Ninject UserManager and UserStore

旧城冷巷雨未停 提交于 2019-12-30 10:58:09
问题 What is the most elegant way to inject UserManager and UserStore into a controller using ninject? For example, the context can be injected like this: kernel.Bind<EmployeeContext>().ToSelf().InRequestScope(); public class EmployeeController : Controller { private EmployeeContext _context; public EmployeeController(EmployeeContext context) { _context = context; } Can ninject inject UserManager and UserStore with a one line of code into a controller?! If not, what is the easiest way? I don't

Shouldn't MVC ignore images by default?

别说谁变了你拦得住时间么 提交于 2019-12-30 10:52:50
问题 If there is 1.jpg image, so it is downloaded and showed <img src="Content/Pages/1.jpg" /> But, if there is no 1.jpg image in Pages folder, so I get the following error The controller for path '/Content/Pages/1.jpg' could not be found or it does not implement IController. I fixed it by registering route to IgnoreRoute , but shouldn't it ignore images by default? routes.IgnoreRoute("Content/{*pathInfo}"); 回答1: That's actually handled by your hosting environment/web server, not by MVC per-se. I

Shouldn't MVC ignore images by default?

拟墨画扇 提交于 2019-12-30 10:52:35
问题 If there is 1.jpg image, so it is downloaded and showed <img src="Content/Pages/1.jpg" /> But, if there is no 1.jpg image in Pages folder, so I get the following error The controller for path '/Content/Pages/1.jpg' could not be found or it does not implement IController. I fixed it by registering route to IgnoreRoute , but shouldn't it ignore images by default? routes.IgnoreRoute("Content/{*pathInfo}"); 回答1: That's actually handled by your hosting environment/web server, not by MVC per-se. I

What is a django-like framework for PHP with auto-generated CRUD pages? [closed]

不问归期 提交于 2019-12-30 10:15:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I'm looking for a simple MVC framework for PHP and would like something that handles basic user auth (for the admin) and generates it's own CRUD pages out of the box. Edit: I'd really like something that creates these admin pages on the fly or "automatically" instead of the whole "baking" concept or having to

How can I call an MVC FileContentResult by Jquery and get it to prompt the user to save on it's return?

守給你的承諾、 提交于 2019-12-30 10:14:32
问题 I'm generating a CSV from an MVC 3 website and using a FileContentResult to pass this to the user. This worked great but it took 30 seconds for the csv to generate and therefore 30 seconds before the prompt to save was given to the user. public virtual FileContentResult GetSpreadsheet(string id) { var service = new SpreadsheetService(); var result = service.GetCSV(); return File(new System.Text.UTF8Encoding().GetBytes(result.Message), "text/csv", "Report123.csv"); } So I thought I'd just call

How can I call an MVC FileContentResult by Jquery and get it to prompt the user to save on it's return?

China☆狼群 提交于 2019-12-30 10:14:09
问题 I'm generating a CSV from an MVC 3 website and using a FileContentResult to pass this to the user. This worked great but it took 30 seconds for the csv to generate and therefore 30 seconds before the prompt to save was given to the user. public virtual FileContentResult GetSpreadsheet(string id) { var service = new SpreadsheetService(); var result = service.GetCSV(); return File(new System.Text.UTF8Encoding().GetBytes(result.Message), "text/csv", "Report123.csv"); } So I thought I'd just call

QT: internal drag and drop of rows in QTableView, that changes order of rows in QTableModel

烈酒焚心 提交于 2019-12-30 10:06:08
问题 I want to perform a sort of rows in QTableView, so that the underlying TableModel would have its data sorted, too: If I'm not mistaken, built-in sorts in QTableView don't affect the order of rows in underlying TableModel, so I had to write a custom QTableView and custom QAbstractTableModel implementation of internal drag and drop. To test, if it works at all, I respond to any drag of cell by reordering first and second rows: import sys from PyQt4.QtGui import * from PyQt4.QtCore import *

spring 3.0 MVC seems to be ignoring messages.properties

梦想与她 提交于 2019-12-30 09:33:41
问题 Spring 3.0 MVC First of all, I haven't found any documentation regarding messages.properties @ springsource Everything I've found about overriding error messages has been on various forums. If anyone has a reference to where messages.properties is documented that'd be fantastic. Maybe messages.properties comes not from spring but a java spec? I have tried following the advice on JSR-303 Type Checking Before Binding My goal is to replace some type mismatch error messages with my own user