-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dca4678
commit 9602099
Showing
1 changed file
with
13 additions
and
10 deletions.
There are no files selected for viewing
23 changes: 13 additions & 10 deletions
23
coffeecard/CoffeeCard.Library/Utils/ProductUserGroupUtils.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |