Add comments by AI
This commit is contained in:
@@ -10,6 +10,10 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#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)
|
public StatsByDzRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#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)
|
public int Add(IEnumerable<StatsByDz> newStats)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -40,6 +49,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
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)
|
public IEnumerable<StatsByDz> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.User)
|
return _col.Include(x => x.User)
|
||||||
@@ -48,6 +62,12 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.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)
|
public bool Update(IEnumerable<StatsByDz> updatedStats, User user)
|
||||||
{
|
{
|
||||||
Delete(user);
|
Delete(user);
|
||||||
@@ -56,6 +76,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return tmp != 0;
|
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)
|
public bool Delete(User user)
|
||||||
{
|
{
|
||||||
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
|
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
|
||||||
@@ -71,4 +96,4 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="StatsByGearRepository"/> class
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider to use for data access</param>
|
||||||
public StatsByGearRepository(IDataProvider dataProvider)
|
public StatsByGearRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new collection of stats by gear to the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newStats">The collection of stats by gear instances to add</param>
|
||||||
|
/// <returns>The number of rows affected</returns>
|
||||||
public int Add(IEnumerable<StatsByGear> newStats)
|
public int Add(IEnumerable<StatsByGear> newStats)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -40,6 +49,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all stats by gear for a specific user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose stats by gear to retrieve</param>
|
||||||
|
/// <returns>A collection of stats by gear instances belonging to the user</returns>
|
||||||
public IEnumerable<StatsByGear> GetAll(User user)
|
public IEnumerable<StatsByGear> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.User)
|
return _col.Include(x => x.User)
|
||||||
@@ -48,6 +62,12 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates existing stats by gear in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updatedStats">The stats by gear 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<StatsByGear> updatedStats, User user)
|
public bool Update(IEnumerable<StatsByGear> updatedStats, User user)
|
||||||
{
|
{
|
||||||
Delete(user);
|
Delete(user);
|
||||||
@@ -56,6 +76,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return tmp != 0;
|
return tmp != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes all stats by gear for a specific user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose stats by gear to delete</param>
|
||||||
|
/// <returns>True if the delete was successful, false otherwise</returns>
|
||||||
public bool Delete(User user)
|
public bool Delete(User user)
|
||||||
{
|
{
|
||||||
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
|
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
|
||||||
@@ -71,4 +96,4 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user