Commit 0b92b558 by xin.yang

some update

parent a24b590c
......@@ -61,6 +61,10 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
if (parent == null)
{
}
var parentGuid = parent?.guid ?? "";
var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid);
if (exsit != null)
......@@ -93,7 +97,6 @@ namespace Siger.ApiACC.Controllers
}
}
[HttpPost]
public IActionResult Update([FromBody]RequestUpdateFixtureToolAssembly req)
{
......@@ -139,9 +142,44 @@ namespace Siger.ApiACC.Controllers
}
[HttpGet]
public IActionResult Delete()
public IActionResult Delete(int id)
{
return Ok();
var entity = _toolsRepository.Get(q => q.projectId == ProjectId && q.id == id);
if (entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
_toolsAssemblyRepository.Delete(entity);
if (_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
[HttpPost]
public IActionResult Deletes([FromBody]RequestDeleteRange req)
{
if (req.ids == null || !req.ids.Any())
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var entities = _toolsAssemblyRepository.GetList(t => req.ids.Contains(t.id) && t.projectId == ProjectId).ToList();
if (!entities.Any())
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
foreach (var entity in entities)
{
_toolsAssemblyRepository.Delete(entity);
}
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
throw new BadRequestException(CommonEnum.Fail);
}
}
}
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