mirror of
https://github.com/ppy/osu
synced 2025-02-20 20:47:09 +00:00
Add boolean return value
This commit is contained in:
parent
654345f380
commit
eaf7697b85
@ -281,7 +281,8 @@ namespace osu.Game.Database
|
||||
/// Is a no-op for already deleted items.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to delete.</param>
|
||||
public void Delete(TModel item)
|
||||
/// <returns>false if no operation was performed</returns>
|
||||
public bool Delete(TModel item)
|
||||
{
|
||||
using (ContextFactory.GetForWrite())
|
||||
{
|
||||
@ -289,10 +290,11 @@ namespace osu.Game.Database
|
||||
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID);
|
||||
|
||||
// Test for null since FirstOrDefault will return null if nothing is found
|
||||
if (foundModel == null || foundModel.DeletePending) return;
|
||||
if (foundModel == null || foundModel.DeletePending) return false;
|
||||
|
||||
if (ModelStore.Delete(foundModel))
|
||||
Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user