แก้ Defect
This commit is contained in:
parent
5ae67ee02e
commit
0096e6dd5b
8 changed files with 184 additions and 97 deletions
|
|
@ -90,7 +90,7 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
|
|
@ -133,11 +133,11 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
{
|
||||
var data = await _context.DisciplineComplaint_Channels.Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var dupicateData = await _context.DisciplineComplaint_Channels.Where(x => x.Id != id && x.Name == req.name).FirstOrDefaultAsync();
|
||||
if (dupicateData != null)
|
||||
return Error(new Exception("ชื่อประเภทนี้มีอยู่ในระบบแล้ว"), (int)StatusCodes.Status400BadRequest);
|
||||
return Error(new Exception("ชื่อประเภทนี้มีอยู่ในระบบแล้ว"), StatusCodes.Status400BadRequest);
|
||||
|
||||
data.Name = req.name;
|
||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
|
|
@ -160,7 +160,7 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
{
|
||||
var data = await _context.DisciplineComplaint_Channels.Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
_context.DisciplineComplaint_Channels.Remove(data);
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue