apiร้องเรียน
This commit is contained in:
parent
2cdf724d58
commit
d06e1af217
24 changed files with 34538 additions and 91 deletions
|
|
@ -55,7 +55,10 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
[HttpGet()]
|
||||
public async Task<ActionResult<ResponseObject>> GetDiscipline(int page = 1, int pageSize = 25, string keyword = "")
|
||||
{
|
||||
var data = await _context.DisciplineComplaint_Channels
|
||||
var data_search = (from x in _context.DisciplineComplaint_Channels
|
||||
where x.Name.Contains(keyword)
|
||||
select x).ToList();
|
||||
var data = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
|
|
@ -63,8 +66,8 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
})
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
return Success(new { data, total = data.Count() });
|
||||
.ToList();
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -133,7 +136,7 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
var dupicateData = await _context.DisciplineComplaint_Channels.Where(x => x.Id != id && x.Name == req.name).FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
if (dupicateData != null)
|
||||
return Error(new Exception("ชื่อประเภทนี้มีอยู่ในระบบแล้ว"), (int)StatusCodes.Status400BadRequest);
|
||||
|
||||
data.Name = req.name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue