Commit 43f95b8e by xin.yang

fix bug

parent 7ca6b796
......@@ -116,7 +116,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.DataExist);
}
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if(parentExsit != null)
if(parentExsit != null && !string.IsNullOrEmpty(parentExsit.parent))
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
......@@ -201,7 +201,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.DataExist);
}
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if (parentExsit != null)
if (parentExsit != null && !string.IsNullOrEmpty(parentExsit.parent))
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
......
......@@ -320,7 +320,7 @@ namespace Siger.ApiACC.Controllers
var exsit = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.parentid.ToInt());
if(exsit == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
throw new BadRequestException(RequestEnum.ParentTypeError);
}
else
{
......@@ -352,6 +352,10 @@ namespace Siger.ApiACC.Controllers
public IActionResult UpdateCategory([FromBody]RequestUpdateFixtureToolsCategory req)
{
var entity = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.id);
if(entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var data = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.name == req.name &&
q.id != req.id);
if (data != null)
......@@ -364,7 +368,7 @@ namespace Siger.ApiACC.Controllers
var exsit = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.parentid.ToInt());
if (exsit == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
throw new BadRequestException(RequestEnum.ParentTypeError);
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment