diff --git a/src/StaffManagement/Controllers/Api/PersonController.cs b/src/StaffManagement/Controllers/Api/PersonController.cs index 219c4a5..e9bc5a3 100644 --- a/src/StaffManagement/Controllers/Api/PersonController.cs +++ b/src/StaffManagement/Controllers/Api/PersonController.cs @@ -6,6 +6,7 @@ using Falcon.Extend; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +using StaffManagement.Database.StaticData; using StaffManagement.Database.Tables; using StaffManagement.Models; @@ -56,8 +57,8 @@ namespace StaffManagement.Controllers.Api [ProducesResponseType(typeof(bool),200)] public bool RemovePerson(int id) { var p = new Person { Id = id }; - //this.Db.People.Attach(p); - this.Db.Entry(p).State = EntityState.Deleted; + this.Db.People.Attach(p); + p.Status = PersonStatusDefinition.Remove; this.Db.SaveChanges(); return true; } diff --git a/src/StaffManagement/Database/StaticData/PersonStatusDefinition.cs b/src/StaffManagement/Database/StaticData/PersonStatusDefinition.cs new file mode 100644 index 0000000..082fb7f --- /dev/null +++ b/src/StaffManagement/Database/StaticData/PersonStatusDefinition.cs @@ -0,0 +1,20 @@ +using System; + +namespace StaffManagement.Database.StaticData +{ + /// + /// 人员状态定义 + /// + [Flags] + public enum PersonStatusDefinition + { + /// + /// 正常 + /// + Normal = 1, + /// + /// 删除 + /// + Remove = 2, + } +} diff --git a/src/StaffManagement/Database/Tables/Person.cs b/src/StaffManagement/Database/Tables/Person.cs index 5bfc5c7..6573a4d 100644 --- a/src/StaffManagement/Database/Tables/Person.cs +++ b/src/StaffManagement/Database/Tables/Person.cs @@ -50,6 +50,6 @@ namespace StaffManagement.Database.Tables /// /// 记录状态 /// - public int Status { get; set; } = 0; + public PersonStatusDefinition Status { get; set; } = PersonStatusDefinition.Normal; } }