Skip to content

Commit

Permalink
Update SupplierApi.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
RenderBr committed Feb 5, 2023
1 parent b183b0e commit 1e8a094
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Supplier/Api/SupplierApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class SupplierApi
{
public string? WorldName { get; set; }

#region Add Chest
public async void AddChest(Chest chest)
{
// add the chest to our database, marking it as infinite
Expand Down Expand Up @@ -38,18 +39,24 @@ await IModel.CreateAsync(CreateRequest.Bson<InfiniteChest>(x =>
x.Items = Items;
}));
}
#endregion


#region Retrieve Chest
public async Task<InfiniteChest> RetrieveChest(int _x, int _y)
{
// retrieve the chest from the coordinates
var entity = await IModel.GetAsync(GetRequest.Bson<InfiniteChest>(x => x.X == _x && x.Y == _y && (x.World == WorldName || string.IsNullOrEmpty(x.World))));
// return the chest
return entity;
}
#endregion

#region Remove Chest
public async void RemoveChest(int _x, int _y)
{
StorageProvider.GetMongoCollection<InfiniteChest>("InfiniteChests").Find(x => x.X == _x && x.Y == _y && (x.World == WorldName || string.IsNullOrEmpty(x.World))).First().DeleteAsync();
}
#endregion
}
}

0 comments on commit 1e8a094

Please sign in to comment.