Removed superfluous try catch throw pattern
This commit is contained in:
@@ -119,35 +119,29 @@ namespace AyaNova.Biz
|
||||
Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction transaction = null;
|
||||
if (parentTransaction == null)
|
||||
transaction = await ct.Database.BeginTransactionAsync();
|
||||
try
|
||||
|
||||
CustomerNote dbObject = await GetAsync(id, false);
|
||||
if (dbObject == null)
|
||||
{
|
||||
CustomerNote dbObject = await GetAsync(id, false);
|
||||
if (dbObject == null)
|
||||
{
|
||||
AddError(ApiErrorCode.NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
if (HasErrors)
|
||||
return false;
|
||||
if (HasErrors)
|
||||
return false;
|
||||
ct.CustomerNote.Remove(dbObject);
|
||||
await ct.SaveChangesAsync();
|
||||
AddError(ApiErrorCode.NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
if (HasErrors)
|
||||
return false;
|
||||
if (HasErrors)
|
||||
return false;
|
||||
ct.CustomerNote.Remove(dbObject);
|
||||
await ct.SaveChangesAsync();
|
||||
|
||||
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, "CustomerNote", ct);
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
|
||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||
//all good do the commit if it's ours
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, "CustomerNote", ct);
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
|
||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||
//all good do the commit if it's ours
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user