I am currently creating a small Laravel project. The goal should be.
Every User can have 1 or more projects. Every project has data that displayed in Datatables.
The Problem. The data for each projects are different in structure (e.g. Addresses, Questionnaire, ...)
I have now created a separate model / view / controller for each project. But I think it's not the right way. e.g. 100 users have 2 projects, then I need 200 model / views / controller ???
How could I do better?
Thanks in advance for your help.
Related
I want to make an MVC 5 app that will allow users to customize views/pages, create new ones. On the custom pages they can set-up widgets and be able to save the views. Also they should be able to setup the default view that will be loaded by default.
Any ideas how can I achieve this? I believe the views should be saved in the database.
EDIT:
I found this template engine RazorEngine. This seams to be what I am looking for. Anybody has any experience using RazorEngine?
I think you should try some CMS like dotnetnuke etc. other wise build your own framework for all the things so that it can save and fetch your details to and from database.
I am using the mvc5 database first approach on a project.
The project is huge, 170 tables or so in the database.
I was wondering, is there a way to automate the scaffolding of the "MVC 5 Controller with views, using entity Framework" per model?
I am pointing to my own Templates (Create.cs.t4, Delete.cs.t4, Details.cs.t4, Edit.cs.t4) and will be changing them quite often
Obviously going through each item to create the "new scaffolding" will take me hours so i was wondering if there is a way to automate this process?
Is there a command i can call to create all the controller and view scaffolding for all the models i have?
As of right now, there is no out-of-the-box solution to automating the scaffolding like you can create a data model for the whole db at once. This would be a good enhancement request to put in, though. Roll up your sleeves or hire a couple of interns.
I am working on a business application which is being developed from scratch. We have opted to design our business logic using Entity Framework, and since the application has to be delivered on the Web we have selected MVC 3 (Razor) for presentation.
Things are pretty fine yet, but I am afraid how will I manage if anytime in the future we need to change our Entity Classes (like adding/removing fields in the business entities or adding more relational entities etc.). I know I can update my model by selecting "Update Model from Database" in Visual Studio (we are using Database first approach). In this case will I have to scrap my old views and generate new ones or is there any way I can update my exiting views.
That questions a little ambigous, so I'll talk about MVC concepts
The whole approach of MVC is "serperation of concerns" so you should be able to lititimatly change your Model (database, entity Framework, etc.) without updating your controllers or views.
That said your model's responsibillity is to return the data required by the controller/view. So it needs to be consistant. So if you model is bound to a view that return data x, if this view is updated, moved to a new platform, etc, etc then the model should still return the same basic information (for it to continue to work with your existing views/controllers).
If your using code first then you should be able to generate any required db views, etc. on a new db, providing this db supports code first generation (so basically MS-SQL I believe)
When using Editor- or DisplayFor you can pass in the entire model and it will show all the properties on the model.
How in an ExtJS 4 MVC single web page application we can identify Views?
Is it a good practice to consider each Ext.Window as a View unit? (one folder for each Window in app/view folder)
What is best practice?
Using single folder for each Window could be a nigthmare.
The concept is not for each window but for each entity (or model).
Having a folder for each model's views is the point.
For example, you have 3 entitites (models) in your application, sat Customer, Invoice, Payment your should have 3 subfolders in view main folder, one for each model. Inside each folder are the views used for CRUD for each model: List and Edit. If you have another views for the same model you should put in their respective folder (inquiry, charts, etc.).
I been working in a payroll application and my rule is use soubfolders as packages as I do in Java. I group related views in the same "package" even if is not for only one model. For example, I have a folder for all "catalog" models (depts, jobs, etc.), another for payroll processing and so.
The MVC of ExtJS is very similar to Ruby on Rails.
Regards.
You should read these before starting your application
http://www.sencha.com/forum/showthread.php?131671-Advanced-MVC-Best-Practices
http://www.sencha.com/learn/architecting-your-app-in-ext-js-4-part-2
I am moving our current ASP.net website to a MVC3 project and am very new to MVC. Currently we have a 2 level authorization for a superadmin and a admin. Both these levels of authorization get directed to a menu where there are some common and some different pages which they each access. I was wondering how I could structure it such that there will be minimum duplication of controller logic with URLs like -
myURL/SuperAdmin
myURL/SuperAdmin/Users
myURL/SuperAdmin/Users/UserId
Similarly for Admin.
For the above kind of URL I may have to duplicate the controller code (for the Users view) in the SuperAdmin as well as the Admin controllers. As both these access the Users View. I would like to avoid this, but have the same URL. We are making use of the existing business layer entity framework (stored procedures) and not using any LinqToSql. Can I use named routing for this? If so, how? I hope I am making myself clear.
Can someone please help? Any ideas and suggestions will be greatly appreciated.
Thanks,
sdd
I'm not entirely clear on this. If you think you will have code duplication then remove that code into common classes that multiple controllers will access. Sure you can have multiple routes point you to the same controller/action methods (if thats what you meant) but I recommend you don't have multiple URI's (excluding varying parameters) that go into the same controller method. It makes your app a bit hard to follow.