public async Task <OutResult> DeleteApplication(int id) { var app = await GetById(id); if (!app.Any()) { return(OutResult.Error_TryingToDeleteNull()); } await _applicationRepository.Delete(app); return(OutResult.Success_Deleted()); }
public virtual async Task <OutResult> Delete(T entity) { try { if (entity == null) { return(OutResult.Error_TryingToDeleteNull()); } this.Entities.Remove(entity); await this._context.SaveChangesAsync(); } catch (Exception dbEx) { var error = $"Failed while Deleting " + typeof(T).FullName + ":: " + GetFullErrorText(dbEx); return(new OutResult(error, dbEx.ToString(), false)); } return(OutResult.Success_Deleted()); }