如何在 MVC.Net 中制作管理面板? [英] How to make Admin Panel in MVC.Net?

查看:19
本文介绍了如何在 MVC.Net 中制作管理面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 ASP.NET MVC 项目中使用区域"实现一个管理面板但我对此没有任何想法.

I want to implement an admin panel in my ASP.NET MVC Project using "Areas" but I don't have any idea about this.

请告诉我如何使用控制器或区域在 ASP.NET MVC 项目中实现管理面板.

Please tell me how to implement an admin panel in an ASP.NET MVC Project, either using Controllers or Areas.

实际上,我正在为诊所实施 ASP.NET MVC 项目,而客户希望通过管理面板处理所有活动.我是初学者做 ASP.NET MVC.

Actually I am implementing an ASP.NET MVC Project for a clinic and the client wants to handle all activity through an admin panel. I am beginner doing ASP.NET MVC.

有人知道怎么做吗?您能否提供一些有关如何在 ASP.NET 中实现它的提示?

Does anyone know how to do this? Can you please provide me with some tips on how to implement it in ASP.NET?

推荐答案

首先

ASP.NET MVC 中的区域用于将逻辑相关的部分组合在一起.通过创建一个 area 你会得到单独的 /Contoller/Views/Model 文件夹和里面的配置文件/Area 文件夹.您还必须为此配置路由.

First of all

Areas in ASP.NET MVC are used to group logically related parts together. By creating an area you'll get separate /Contoller, /Views and /Model folders and config file inside the /Area folder. You'll further have to configure routes for that.

我建议您首先在默认的 Intranet 应用程序中创建一个简单的区域.这是一个关于如何操作的简短教程.

I would recommend you to first create a simple area in your default intranet application. Here is a short tutorial on how to do it.

现在,一旦您解决了区域问题,那么您可能想要继续创建管理面板.我从管理面板"一词中了解到,您希望针对数据库中每个表的页面执行 CRUD 操作.

Now once you have area problem solved then you would probably want to proceed to create admin panel. What I understand from your word "admin panel" is that you want a page against every table in your database to perform CRUD operations on them.

在这里,您需要阅读 ASP.NET MVC 的基础知识,了解如何使用 ASP.NET MVC 连接到数据库.提示:dbContext.

Here you'll need to read the basics of ASP.NET MVC on how to connect to database using ASP.NET MVC. Hint: dbContext.

/Models 文件夹中为您的表创建一个 model.添加 Controller 在您的 /Controller 文件夹中.默认情况下会有一个动作.您可以更改其名称或创建新名称.

Create a model for you table in /Models folder. Add a Controller in your /Controller folder. By default there will be an action. You can change its name or create new one.

您可以创建您的视图 从脚手架中通过右键单击控制器中的操作名称,在这里您将看到模型列表以选择这些视图的模型,选择您在 /Model 文件夹中创建的模型.

You can create your Views from scaffolding by right-clicking action name in your controller, here you will have be shown models list to select model for these views, Select the model you created in your /Model folder.

此外,我会建议您阅读有关 ASP.NET MVC 的一本书或一些视频讲座(Scott allen 的讲座非常适合基本理解),并寻找管理面板的工作方式以及从头开始创建它们的最佳方法.

Further I will recommend you grab a book or some video lectures (Scott allen's lecture are pretty good for basic understanding) on ASP.NET MVC and also look for how the admin panels work and what's the best way to create them from scratch.

这篇关于如何在 MVC.Net 中制作管理面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆