asp.net core + layui.js 搭建仓储系统
先放几张网站图片:




第一步先从layui 网站https://www.layui.com/doc/ 下载相关文件,复制到项目 wwwroot 目录下:

然后在 _Layout.cshtml 中引用 layui.js 和 layui.css,以及添加左侧栏和头部布局(具体操作见 : https://www.layui.com/doc/element/nav.html)
后端框架:

控制器通过依赖注入引用服务(asp.net core 默认支持)。
Startup.cs 配置数据库连接,Session(用于登录和菜单缓存),添加服务到服务容器。
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
} public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMemoryCache();
services.AddSession(options => {
options.IdleTimeout = TimeSpan.FromMinutes();
});
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
}); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(); services.AddMvc(
options =>
{
options.Filters.Add<HttpGlobalExceptionFilter>(); //加入全局异常类
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddDbContext<AccessManagementContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),
providerOptions => providerOptions.EnableRetryOnFailure()));
services.AddDbContext<LuJCDBContext>(options =>
options.UseSqlServer(Configuration["WMSConnectionStrings:DefaultConnection"],
providerOptions => providerOptions.EnableRetryOnFailure()));
services.AddTransient<CompanyServices, CompanyServices>();
services.AddTransient<BasicInfoServices, BasicInfoServices>();
services.AddTransient<AppMenuServices>();
services.AddTransient<IAccountServices,AccountServices>();
services.AddTransient<BranchServices>();
services.AddTransient<PresetFunctionServices>();
services.AddTransient<RoleServices>();
services.AddTransient<LocationServices>();
services.AddTransient<SupplierServices>();
services.AddTransient<CustomerServices>();
services.AddTransient<MeasureServices>();
services.AddTransient<ProductCategoryServices>();
services.AddTransient<ProductServices>();
services.AddTransient<InStorageServices>();
services.AddTransient<OutStorageServices>();
services.AddTransient<BadReportServices>();
services.AddTransient<CheckStockServices>();
services.AddTransient<LocalProductServices>();
//services.AddScoped<AddHeaderFilterWithDI>();
services.AddAutoMapper(typeof(Startup));
Mapper.Initialize(cfg =>
{
cfg.AddProfile<AccessManagementProfile>();
}
);
//Mapper.Initialize(cfg => cfg.CreateMap<AppMenu, AppMenuViewModel>());
} // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env,ILoggerFactory loggerFactory)
{
app.UseSession(); loggerFactory.AddNLog(); //添加NLog
NLog.LogManager.LoadConfiguration("nlog.config");
app.UseLog();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseStaticFiles();
var cookiePolicyOptions = new CookiePolicyOptions
{
MinimumSameSitePolicy = SameSiteMode.Strict,
};
app.UseCookiePolicy(cookiePolicyOptions);
app.UseAccountSession();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapAreaRoute("IMS", "IMS", "IMS/{controller}/{action}/{id?}",
defaults: new { Controller = "Location", Action = "Index" });
routes.MapAreaRoute("WMS", "WMS", "WMS/{controller}/{action}/{id?}",
defaults: new { Controller = "InStorage", Action = "Index" });
routes.MapAreaRoute("Report", "Report", "Report/{controller}/{action}/{id?}",
defaults: new { Controller = "LocalProduct", Action = "Index" });
}); }
}
asp.net core + layui.js 搭建仓储系统的更多相关文章
- Asp.net Core + Log4net + ELK 搭建日志中心
原文:Asp.net Core + Log4net + ELK 搭建日志中心 Docker中一键安装ELK 对于这种工具类的东西,第一步就直接到docker的hub中查找了,很幸运,不仅有Elasti ...
- ASP.NET Core下FreeSql的仓储事务
ASP.NET Core下FreeSql的仓储事务 第一步:配置 Startup.cs 注入 引入包 dotnet add package FreeSql dotnet add package Fre ...
- ASP.NET Core 使用 JWT 搭建分布式无状态身份验证系统
为什么使用 Jwt 最近,移动开发的劲头越来越足,学校搞的各种比赛都需要用手机 APP 来撑场面,所以,作为写后端的,很有必要改进一下以往的基于 Session 的身份认证方式了,理由如下: 移动端经 ...
- ASP.NET Core 一步步搭建个人网站(7)_Linux系统移植
摘要 考虑我们为什么要选择.NET Core? 因为它面向的是高性能服务器开发,抛却了 AspNet 的臃肿组件,非常轻量,加上微软的跨平台战略,对 Docker 的亲和性,对于开发人员也非常友好,所 ...
- ASP.NET Core 一步步搭建个人网站(持续更新中~~~)
摘要 ASP.NET Core2.0发布有一阵子了,这是.NET 开源跨平台的一个重大里程碑, 也意味着比1.0版本要更加成熟.目前.net core具有开源.跨平台.灵活部署.模块化架构等等特性,吸 ...
- ASP.NET Core + Vue.js 开发
1.新建 项目文件夹 pro,在 VS CODE 打开终端,输入dotnet new mvc 命令,新建asp.net core项目. 2.在Startup.cs添加webpack的引用与配置 usi ...
- ASP.NET Core 一步步搭建个人网站(1)_环境搭建
ASP.NET Core2.0发布有一阵子了,这是.NET 开源跨平台的一个重大里程碑, 也意味着比1.0版本要更加成熟.目前.net core具有开源.跨平台.灵活部署.模块化架构等等特性,吸引着一 ...
- asp.net core结合NLog搭建ELK实时日志分析平台
0.整体架构 整体架构目录:ASP.NET Core分布式项目实战-目录 一.介绍ELK 1.说明(此篇ELK采用rpm的方式安装在服务器上)-牛刀小试 承接上一篇文章的内容准备部署ELK来展示asp ...
- 使用asp.net core 3.0 搭建智能小车1
跟随.net core 3.0 一起发布的System.Device.Gpio 1.0已经可以让我们用熟悉的C#原汁原味的开发莓派上面的GPIO了.并且在 Iot.Device.Bindings这个包 ...
随机推荐
- 关于selenium自动化对窗口句柄的处理
首先什么是句柄?句柄就是你点击一个页面,跳转了一个新的窗口.你要操作的元素可能在原窗口上,也有可能在新窗口上. 看下图句柄1 句柄2 由这2张图可知,url不一样,证明他们是处于不同的界面,我要操作的 ...
- 《Java 8 in Action》Chapter 5:使用流
流让你从外部迭代转向内部迭代,for循环显示迭代不用再写了,流内部管理对集合数据的迭代.这种处理数据的方式很有用,因为你让Stream API管理如何处理数据.这样Stream API就可以在背后进行 ...
- 原生js实现的一个随机颜色的简单效果
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta na ...
- The used SELECT statements have a different number of columns???
今天我们组就我一个人留守在这里修复bug了,有点小悲伤啊,他们都问我能不能hold得住啊,我当然能hold得住啊: 在看一个入库的存储过程中,在数据库运行的时候是没问题的,项目已启动,进行入库操作就是 ...
- C#Socket_TCP(客户端,服务器端通信)
客户端与服务器通信,通过IP(识别主机)+端口号(识别应用程序). IP地址查询方式:Windows+R键,输入cmd,输入ipconfig. 端口号:可自行设定,但通常为4位. 服务器端: usin ...
- MSIL实用指南-加载和保存参数
本篇讲解怎么加载和保存参数,以及参数起始序号的确定. 参数的加载加载参数的指令是Ldarg.Ldarg_S.Ldarg_0.Ldarg_1.Ldarg_2.Ldarg_3.Ldarg_0是加载第0个参 ...
- XHTML 和 HTML 中的 iframe
1. XHTML 有什么? XHTML是更严谨更纯净的HTML版本. 2.HTML和XHTML之间的差异 ①XHTML元素必须被正确的嵌套 /!--错误写法--/ <p><i> ...
- (六)分布式通信----MessagePack序列化
1. .Net Core的序列化方式 1.1 json.Net 常用的工具包,如Newtonsoft.Json, 它是基于json格式的序列化和反序列化的组件 json.net 有以下优点: 侵入性: ...
- Delphi - 互斥对象下实现系统的单例模式
使用CreateMutex函数创建互斥对象 利用Windows系统函数CreateMutex(),找出当前系统是否已经存在指定进程的实例,如果没有则创建一个互斥体. CreateMutex函数原型如下 ...
- shell操作钉钉机器人实现告警提醒
我们知道,之前的运维告警多通过mail 等方式通知到相应的人员,难以实现随时随地的查看.随着手机APP的发展,很多告警开始发送到IM软件上去.目前比较常用的是发送到微信和钉钉上,今天我们将重点放在钉钉 ...