Skip to content

Commit

Permalink
Fix sonarcloud bug 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
fredpetersen committed Oct 12, 2023
1 parent dca4678 commit 9602099
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions coffeecard/CoffeeCard.Library/Utils/ProductUserGroupUtils.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
using System.Linq;
using CoffeeCard.Models.Entities;

public static class ProductUserGroupUtils
namespace CoffeeCard.Library.Utils
{
/// <summary>
/// Determines whether a product is a perk or not.
/// A product is a perk if it is not available for regular customers.
/// </summary>
/// <param name="context">The DbContext to use for querying the database.</param>
/// <param name="product">The product to check.</param>
/// <returns>True if the product is a perk, false otherwise.</returns>
public static bool isPerk(this Product product)
public static class ProductUserGroupUtils
{
return product.ProductUserGroup.Any(pug => pug.UserGroup != UserGroup.Customer);
/// <summary>
/// Determines whether a product is a perk or not.
/// A product is a perk if it is not available for regular customers.
/// </summary>
/// <param name="context">The DbContext to use for querying the database.</param>
/// <param name="product">The product to check.</param>
/// <returns>True if the product is a perk, false otherwise.</returns>
public static bool isPerk(this Product product)
{
return product.ProductUserGroup.Any(pug => pug.UserGroup != UserGroup.Customer);
}
}
}

0 comments on commit 9602099

Please sign in to comment.