เพิ่มคำสั่งในกรรมการ
This commit is contained in:
parent
b371717f89
commit
bcd4a6bd87
9 changed files with 3121 additions and 0 deletions
|
|
@ -190,5 +190,79 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ประวัติการสืบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("investigate/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetHistoryDisciplineInvestigate(Guid id)
|
||||
{
|
||||
var director = await _context.DisciplineDirectors.Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var data = await _context.DisciplineInvestigates
|
||||
.Where(x => x.DisciplineInvestigate_Directors
|
||||
.Where(x => x.DisciplineDirector == director)
|
||||
.FirstOrDefault() != null
|
||||
)
|
||||
.Select(x => new
|
||||
{
|
||||
Title = x.Title,
|
||||
Director = x.DisciplineInvestigate_Directors.Select(y => new
|
||||
{
|
||||
CommandNo = y.CommandNo,
|
||||
Duty = y.Duty,
|
||||
Prefix = y.DisciplineDirector.Prefix,
|
||||
FirstName = y.DisciplineDirector.FirstName,
|
||||
LastName = y.DisciplineDirector.LastName,
|
||||
}),
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ประวัติการสอบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("disciplinary/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetHistoryDisciplineDisciplinary(Guid id)
|
||||
{
|
||||
var director = await _context.DisciplineDirectors.Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Where(x => x.DisciplineDisciplinary_DirectorInvestigates
|
||||
.Where(x => x.DisciplineDirector == director)
|
||||
.FirstOrDefault() != null
|
||||
)
|
||||
.Select(x => new
|
||||
{
|
||||
Title = x.Title,
|
||||
Director = x.DisciplineDisciplinary_DirectorInvestigates.Select(y => new
|
||||
{
|
||||
CommandNo = y.CommandNo,
|
||||
Duty = y.Duty,
|
||||
Prefix = y.DisciplineDirector.Prefix,
|
||||
FirstName = y.DisciplineDirector.FirstName,
|
||||
LastName = y.DisciplineDirector.LastName,
|
||||
}),
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue