Former-commit-id: c4cebc94f73e8e9e4913b66bfb4d5db22520394c
TangShanKaiPing
wanggang 5 years ago
parent 773297770b
commit 6fc243a1e5

@ -168,9 +168,6 @@
<PackageReference Include="OpenCvSharp4.Windows">
<Version>4.2.0.20200208</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher">
<Version>2.0.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Content Include="lib\DirectShowLib-2005.dll" />

@ -1,5 +1,4 @@
using Microsoft.EntityFrameworkCore;
using System;
namespace CameraCard.Data
{
@ -8,7 +7,12 @@ namespace CameraCard.Data
public DbSet<User> Users { get; set; }
public DbSet<Student> Students { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite("Data Source=data.db;Password=123456;");
//SQLitePCLRaw.bundle_e_sqlcipher
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseSqlite("Data Source=data.db;");
//options.UseSqlite("Data Source=data.db;Password=123456;");
}
public static void Init()
{
@ -25,6 +29,5 @@ namespace CameraCard.Data
{
//this.Users.Add(new User { UserName = "admin", Password = "123456" });
}
}
}

@ -103,6 +103,7 @@ namespace CameraCard
if (user == null)
{
user = new User { UserName = userName, Password = password, PasswordHash = result.data };
db.Users.Add(user);
}
else
{
@ -112,8 +113,9 @@ namespace CameraCard
db.SaveChanges();
MainForm.User = user;
}
this._progress?.SetProgress("登录成功,正在加载数据", 50);
this._progress?.SetProgress("登录成功,正在更新数据", 50);
MainForm.LoadData(this._progress);
this._progress?.SetProgress("数据更新完毕", 100);
this._progress.CloseProgress();
this.Invoke(new Action(() =>
{

@ -165,12 +165,12 @@ namespace CameraCard
if (entity == null)
{
entity = item;
db.Students.Add(entity);
progress?.SetProgress($"正在加载{entity.Name}", 50);
}
else
{
progress?.SetProgress($"正在更新{entity.Name}", 50);
entity.Adapt(item);
}
db.SaveChanges();

@ -47,5 +47,19 @@ namespace WebApi.Controllers
}
return new ApiResponse { Code = 1, Message = "用户名不能为空" };
}
[HttpPost]
[Route("/api/[action]")]
public ApiResponse Push([FromBody]PushRequest model)
{
if (ModelState.IsValid)
{
return new ApiResponse
{
Code = 0
};
}
return new ApiResponse { Code = 1, Message = "数据验证失败" };
}
}
}

@ -0,0 +1,10 @@
namespace WebApi.Models
{
public class PushRequest
{
public string Id { get; set; }
public string Name { get; set; }
public string IdCardNo { get; set; }
public string Image { get; set; }
}
}
Loading…
Cancel
Save