jquery - ASP.NET MVC portal/CMS - controller and widget design? -


I am currently working on a portal using portlets / sortable / draggable which also includes the content management system, Only the controller can change the layout / content of the site which is in 2.

Each view receives personalization for the page (from the base controller) based on the controller and the action, after which the view disappears through the visits and makes the presentation call for each of them.

Currently, I have the "edit" verb on each view to set in the editing mode on the page. As I repeat the code, there should be a better way, but I can not see it for my life!

How will you allow each view to be edited?

  public proceeding legal () {Page model model = GetPageSetting (); See refresh ("portal", model pagesetting, master path, model); } [HTTP Post] [Authorized (Roles = "Administrator")] Public Action Legal Editing (Editor Modell E) {Page MODEL Model = GetPageSetting ("Legal", "Home", True); See refresh ("portal", model pagesetting, master path, model); }  

// This is in the Base Controller

  GetPageSetting Safe PageModel (String Action, String Controller, bool Editing) {Personalized Process Personalization Process = New Personalization Process ( ); String path = string Format ("~ / {0} / {1}", Controller, Action); String username; Bool is authorized; If (user == empty) {userName = "TestUser"; Is official = wrong; } And {userName = User.Identity.Name; Certified = Users Recognise. Valid; } PageSetting Settings = Personalization Process GetPageSetting (User Name, Approved, Path); PageModel Model = New PageModel (); Model Act = action; Model Con = controller; Model. Editing = Editing; Model.PageSetting = Settings; Return model; Without looking at the code, it is difficult to give specific advice on how to avoid it.  

Code duplication, but normally you want "extract method / extract class", as long as you can not remove it further :) ... Besides, you use some MVC infrastructure to help in some repetitive code can do. Modalbinders and action filters.

You may post some better view / editing actions code


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -