ปรับให้เป็น process ที่ควรบันทึกตามลำดับ #224
This commit is contained in:
parent
2bdb8bb733
commit
5b0fcd0680
10 changed files with 260 additions and 143 deletions
|
|
@ -758,6 +758,17 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
var data = await _context.PlacementOfficers
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
// Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ
|
||||
var firstRef = req.refIds.FirstOrDefault();
|
||||
var commandNoText = firstRef != null ? $"{firstRef.commandNo}/{firstRef.commandYear.ToThaiYear()}" : null;
|
||||
foreach (var profile in data)
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.commandNo = commandNoText;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
|
|
@ -809,17 +820,16 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
//data.ForEach(profile => profile.Status = "DONE");
|
||||
foreach (var profile in data)
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.commandNo = resultData.Count > 0 ? $"{resultData[0].commandNo}/{resultData[0].commandYear.ToThaiYear()}" : null;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
//// var _result = await _res.Content.ReadAsStringAsync();
|
||||
//// if (_res.IsSuccessStatusCode)
|
||||
//// {
|
||||
//// foreach (var profile in data)
|
||||
//// {
|
||||
//// profile.Status = "DONE";
|
||||
//// profile.commandNo = resultData.Count > 0 ? $"{resultData[0].commandNo}/{resultData[0].commandYear.ToThaiYear()}" : null;
|
||||
//// }
|
||||
//// await _context.SaveChangesAsync();
|
||||
//// }
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue