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这个包 ...
随机推荐
- hdu6703_array
题意 给定一个1到\(n\)的全排列,两种操作,将\(a_{pos}\)修改为\(a_{pos}+1000000\),询问第一个大于等于\(k\)的且不在\(a_1...a_r\)的数. 分析 由于\ ...
- switch语句(上)(转载)
switch语句是C#中常用的跳转语句,可以根据一个参数的不同取值执行不同的代码.switch语句可以具备多个分支,也就是说,根据参数的N种取值,可以跳转到N个代码段去运行.这不同于if语句,一条单独 ...
- css_transition_animation(内含贝赛尔曲线详解)
区别: transition也叫过渡动画,主要是用于让一个元素从一种状态过渡到另一种状态效果,常用于主动触发的效果.例如移动端的页面切换(很常用).button点击效果(也很常见). animatio ...
- 用户数从 0 到亿,我的 K8s 踩坑血泪史
作者 | 平名 阿里服务端开发技术专家 导读:容器服务 Kubernetes 是目前炙手可热的云原生基础设施,作者过去一年上线了一个用户数极速增长的应用:该应用一个月内日活用户从零至四千万,用户数从零 ...
- 探索Asp net core3中的 项目文件、Program.cs和通用host(译)
引言 原文地址 在这篇博客中我将探索一些关于Asp.net core 3.0应用的基础功能--.csproj 项目文件和Program源文件.我将会描述他们从asp.net core 2.X在默认模版 ...
- 2019nc#7
题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A String 点击查看 进入讨论 566/3539 通过 B Irreducible Polynomial 点击查看 规律 730/229 ...
- P2486 [SDOI2011]染色 维护区间块数 树链剖分
https://www.luogu.org/problemnew/show/P2486 题意 对一个树上维护两种操作,一种是把x到y间的点都染成c色,另一种是求x到y间的点有多少个颜色块,比如11 ...
- CodeForces - 445B - DZY Loves Chemistry-转化问题
传送门:http://codeforces.com/problemset/problem/445/B 参考:https://blog.csdn.net/littlewhite520/article/d ...
- CodeForces gym Nasta Rabbara lct
Nasta Rabbara 题意:简单来说就是, 现在有 n个点, m条边, 每次询问一个区间[ l , r ], 将这个区间的所有边都连上, 如果现在的图中有奇数环, 就输出 “Impossibl ...
- bzoj 1588: [HNOI2002]营业额统计(splay入门)
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1588 题解:这题如果用普通的bst的话是可以过时间差不多4s左右如果用splay的话是14 ...