Removed superfluous try catch throw pattern

This commit is contained in:
2021-08-05 23:14:12 +00:00
parent 7c033a6e84
commit 49bd0d2d87
35 changed files with 2184 additions and 2684 deletions

View File

@@ -152,35 +152,27 @@ namespace AyaNova.Biz
{
using (var transaction = await ct.Database.BeginTransactionAsync())
{
try
var dbObject = await GetAsync(id, false);
if (dbObject == null)
{
var dbObject = await GetAsync(id, false);
if (dbObject == null)
{
AddError(ApiErrorCode.NOT_FOUND);
return false;
}
await ValidateCanDeleteAsync(dbObject);
if (HasErrors)
return false;
if (HasErrors)
return false;
ct.TravelRate.Remove(dbObject);
await ct.SaveChangesAsync();
AddError(ApiErrorCode.NOT_FOUND);
return false;
}
await ValidateCanDeleteAsync(dbObject);
if (HasErrors)
return false;
if (HasErrors)
return false;
ct.TravelRate.Remove(dbObject);
await ct.SaveChangesAsync();
//Log event
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct);
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
await transaction.CommitAsync();
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
}
catch
{
throw;
}
//Log event
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct);
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
await transaction.CommitAsync();
await HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
return true;
}
}
@@ -253,7 +245,7 @@ namespace AyaNova.Biz
}
}
if (!isNew && (proposedObj.Cost != currentObj.Cost || proposedObj.Charge != currentObj.Charge))
{