model-view-controller

MVC or MVP architecture for winform applications using Entity Framework as ORM

风格不统一 提交于 2020-01-12 04:02:33
问题 I am going to develop a winform project of considerable size. I am planning to use Entity Framework as ORM tool. Now I am searching for an architecture(MVC/MVP/MVVM etc..) to implement all these. Firstly there are few choices for n-layered architecture for windows forms and most those I get are written prior to EF came into market. I got a framework called Rocket Framework from codeplex(http://rocketframework.codeplex.com) I have looked around it but am skeptical that it will accommodate a

MVC: how to ajax?

喜你入骨 提交于 2020-01-11 19:42:09
问题 I'm going to start a project using a Zend Framework MVC implementation. How do I work with ajax? I mean, should I place all ajax code into controller? Or into view? For example, I want to get posts from author 'ivan' to show on a page. Normally, I create a link to '/posts/author/ivan' or smth like it, create a new Action like 'byAuthorAction()' in the Posts controller (or maybe Users controller, wherever), view for it (and all code what gets posts from model goes there) and create a new Route

rails structuring routes/controller/views for nested resources

寵の児 提交于 2020-01-11 13:25:10
问题 I have rails app with the following structure: user has_many posts post has_many post_comments post_comment has_many comment_replies I'm planning to use the following routes to avoid deep nesting. resources :posts do resources :post_comments, module: :posts end resources :comments do resources :comment_replies, module: :post_comments #is this module a good choice? end This gives the following controller structure post_comments GET /posts/:post_id/comments(.:format) posts/comments#index POST

rails structuring routes/controller/views for nested resources

霸气de小男生 提交于 2020-01-11 13:25:02
问题 I have rails app with the following structure: user has_many posts post has_many post_comments post_comment has_many comment_replies I'm planning to use the following routes to avoid deep nesting. resources :posts do resources :post_comments, module: :posts end resources :comments do resources :comment_replies, module: :post_comments #is this module a good choice? end This gives the following controller structure post_comments GET /posts/:post_id/comments(.:format) posts/comments#index POST

Reloading the page or manually type URL like “localhost/mysite.com/contact” gives wrong “Not Found”(404 error) on the server in angular js

若如初见. 提交于 2020-01-11 12:39:20
问题 Reloading the page or manually type URL like "localhost/mysite.com/contact" gives wrong "Not Found"(404 error) on the server. This is because MVC does not know about angular routing and by MVC pattern it will look for an MVC page for 'contact' which does not exist in MVC routing path. I think there is a solution by .haccess file by redirect all links to the index page, but it, not a good idea. I already add a baseURL constant to the application in head. and the js part is below: app.config

Is it possible to have a non-public parameterless constructor that can be used for model binding?

天涯浪子 提交于 2020-01-11 12:27:50
问题 I have a following POCO class. I don not want the parameterless constructor to be public. public class FileDownloadRequest { //public FileDownloadRequest() { } public FileDownloadRequest(int fileId, RepositoryFolderTypes fileType) //RepositoryFolderTypes is an enum, not a class { this.FileId = fileId; this.FileType = fileType; } public int FileId { get; set; } public RepositoryFolderTypes FileType { get; set; } //an enum } When I am trying a https://10.27.8.6/Files/DownloadFile?fileId=1

Model structure in many to many relationship

自闭症网瘾萝莉.ら 提交于 2020-01-11 11:45:12
问题 For example if i have following tables in my database and Student and Course has many to many relationship. Student ------- Id (Primary Key) FirstName LastName Course ------ Id (Primary Key) Title StudentCourse ------------- StudentId (Foreign Key -> Student) CourseId (Foreign Key -> Course) Now if my model is as follows public class Student { private int ID; private String firstName; private String lastName; //getter and setter } and public class Course { private int ID; pirvate String title

iOS MVC - Passing data back and forth to view controllers and model

独自空忆成欢 提交于 2020-01-11 11:25:09
问题 I'm new to iOS programming and having written a simple reminders style app, I'm now rewriting it to implement the MVC model correctly as previously all my code was inside View Controllers. I have a custom class called Event with properties name, time, repeat etc and then the following structure: Model class Retrieves, processes and and saves data to and from NSUserDefaults RootViewController Creates an instance of the Model object and asks the model to return all the Events objects from

How to put Play! controllers in an arbitrary sub-package

我的未来我决定 提交于 2020-01-11 08:46:47
问题 I'm using the Play Framework for a web app in Java. I'd like to put an Account controller in an "account" subpackage, for example: |- controllers |- account |- Account.java While my views are organized like: |- views |- Account |- index.html The Account.java file contains: package controllers.account; import play.mvc.Controller; public class Account extends Controller { public static void index() { render(); } } I'd like to have the following behavior: when a request is made to http:/

Set focus on on ASP.NET MVC model errors

…衆ロ難τιáo~ 提交于 2020-01-10 19:08:06
问题 I've got a model that does some validation checking and adds the errors to ModelState: ViewData.ModelState.AddModelError("mycontrol", "message") They display fine on the view side, but is there a way to set the focus to the control that corresponds to the validation message? Right now, the page refreshes and stays at the top of the page, so if the error is towards the end of the page, it's not obvious to the user what happened. Note: Another solution would be for ValidationSummary to show the