优化接口

This commit is contained in:
tongfei
2024-04-12 17:16:22 +08:00
parent 825a7312eb
commit f2b53a7e0a
4 changed files with 7 additions and 7 deletions

View File

@@ -171,7 +171,7 @@ namespace WMS.Web.Repositories
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<InStock> Update(InStock entity, bool isTransaction = true)
public async Task<bool> Update(InStock entity, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
@@ -183,7 +183,7 @@ namespace WMS.Web.Repositories
.Include(s => s.ErpDetails)
.FirstOrDefaultAsync(f => f.Id == entity.Id);
if (model == null)
return null;
return false;
_mapper.Map(entity, model);
//子集单独映射
_mapper.ToMapList(entity.Details, model.Details);
@@ -192,13 +192,13 @@ namespace WMS.Web.Repositories
await _context.SaveChangesAsync();
if (_transaction != null)
_transaction.Commit();
return model;
return true;
}
catch (Exception ex)
{
if (_transaction != null)
_transaction.Rollback();
return null;
return false;
}
}