mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Fixed created assets not showing on list until site refresh
This commit is contained in:
@@ -66,6 +66,7 @@ public class AssetsController : Controller
|
||||
[HttpPost("Create")]
|
||||
public async Task<AssetsCreateResponseModel> Create([FromBody]AssetsCreateRequestModel assetModel)
|
||||
{
|
||||
string? assetId;
|
||||
AssetsCreateResponseModel result;
|
||||
if (assetModel is null)
|
||||
{
|
||||
@@ -82,8 +83,8 @@ public class AssetsController : Controller
|
||||
[
|
||||
new LdapAttribute("objectClass", ["top", "device", "extensibleObject"]),
|
||||
];
|
||||
|
||||
attributeSet.Add(new LdapAttribute("cn", await _ldap.GetAssetCounterAndIncrementAsync()));
|
||||
assetId = await _ldap.GetAssetCounterAndIncrementAsync();
|
||||
attributeSet.Add(new LdapAttribute("cn", assetId));
|
||||
if (assetModel.SerialNumber != null)
|
||||
{
|
||||
attributeSet.Add(new LdapAttribute("serialNumber", assetModel.SerialNumber));
|
||||
@@ -107,7 +108,7 @@ public class AssetsController : Controller
|
||||
}
|
||||
|
||||
await _ldap.CreateAsset(attributeSet);
|
||||
result = new AssetsCreateResponseModel(successful: true);
|
||||
result = new AssetsCreateResponseModel(successful: true, assetId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user