ปรับปรุงการจัดลำดับ และการสร้างลำดับอัตโนมัติ

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-04-11 12:27:33 +07:00
parent 5a9f7370b5
commit 8d1bc4cc34
4 changed files with 28 additions and 3 deletions

View File

@@ -157,6 +157,20 @@ namespace TodoAPI2.Models
var entity = GetEntity(model);
entity.id = GetNewPrimaryKey();
if (!model.mission_no.HasValue)
{
var max_mission = (from i in _repository.Context.eva_evaluation_operating_agreement
where i.create_evaluation_detail_id == model.create_evaluation_detail_id
select i.mission_no).Max();
if (max_mission.HasValue)
{
entity.mission_no = max_mission + 1;
}
else
{
entity.mission_no = 1;
}
}
entity.SetAutoField(_repository.Context);