ปรับปรุงการจัดลำดับ และการสร้างลำดับอัตโนมัติ
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user