Add comments by AI

This commit is contained in:
2026-04-17 17:39:43 +02:00
parent b03085acbe
commit 41669e670a
2 changed files with 52 additions and 2 deletions
@@ -10,6 +10,10 @@ namespace skydiveLogs_api.Infrastructure
{
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="StatsByDzRepository"/> class
/// </summary>
/// <param name="dataProvider">The data provider to use for data access</param>
public StatsByDzRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
/// <summary>
/// Adds a new collection of stats by drop zone to the database
/// </summary>
/// <param name="newStats">The collection of stats by drop zone instances to add</param>
/// <returns>The number of rows affected</returns>
public int Add(IEnumerable<StatsByDz> newStats)
{
int result = 0;
@@ -40,6 +49,11 @@ namespace skydiveLogs_api.Infrastructure
return result;
}
/// <summary>
/// Retrieves all stats by drop zone for a specific user
/// </summary>
/// <param name="user">The user whose stats by drop zone to retrieve</param>
/// <returns>A collection of stats by drop zone instances belonging to the user</returns>
public IEnumerable<StatsByDz> GetAll(User user)
{
return _col.Include(x => x.User)
@@ -48,6 +62,12 @@ namespace skydiveLogs_api.Infrastructure
.ToList();
}
/// <summary>
/// Updates existing stats by drop zone in the database
/// </summary>
/// <param name="updatedStats">The stats by drop zone instances to update</param>
/// <param name="user">The user whose stats to update</param>
/// <returns>True if the update was successful, false otherwise</returns>
public bool Update(IEnumerable<StatsByDz> updatedStats, User user)
{
Delete(user);
@@ -56,6 +76,11 @@ namespace skydiveLogs_api.Infrastructure
return tmp != 0;
}
/// <summary>
/// Deletes all stats by drop zone for a specific user
/// </summary>
/// <param name="user">The user whose stats by drop zone to delete</param>
/// <returns>True if the delete was successful, false otherwise</returns>
public bool Delete(User user)
{
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
@@ -71,4 +96,4 @@ namespace skydiveLogs_api.Infrastructure
#endregion Private Fields
}
}
}