#467 DeleteCatCorrectionsAsync
This commit is contained in:
parent
2cb078efc4
commit
3f65ff1af5
@ -20600,6 +20600,14 @@
|
||||
<param name="correction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.DeleteCatCorrectionsAsync(System.Guid,System.Int32)">
|
||||
<summary>
|
||||
delete unreviewed user corrections for a cat
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<param name="catId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RMuseum.Services.Implementation.GanjoorService.AggressiveCacheEnabled">
|
||||
<summary>
|
||||
aggressive cache
|
||||
|
||||
@ -3916,6 +3916,25 @@ namespace RMuseum.Services.Implementation
|
||||
return new RServiceResult<GanjoorCatCorrectionViewModel>(correction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// delete unreviewed user corrections for a cat
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="catId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> DeleteCatCorrectionsAsync(Guid userId, int catId)
|
||||
{
|
||||
var preCorrections = await _context.GanjoorCatCorrections
|
||||
.Where(c => c.UserId == userId && c.CatId == catId && c.Reviewed == false)
|
||||
.ToListAsync();
|
||||
if (preCorrections.Count > 0)
|
||||
{
|
||||
_context.GanjoorCatCorrections.RemoveRange(preCorrections);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return new RServiceResult<bool>(true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// aggressive cache
|
||||
|
||||
Loading…
Reference in New Issue
Block a user