15 lines
512 B
C#
15 lines
512 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using TIAM.Entities.Products;
|
|
|
|
namespace TIAM.Database.DbSets.Products;
|
|
|
|
public static class ProductDbSetExtensins
|
|
{
|
|
#region Add, Update, Remove
|
|
public static bool AddProduct(this IProductDbSet ctx, Product product)
|
|
=> ctx.Products.Add(product).State == EntityState.Added;
|
|
#endregion Add, Update, Remove
|
|
|
|
public static Product? GetProductById(this IProductDbSet ctx, Guid productId)
|
|
=> ctx.Products.FirstOrDefault(x => x.Id == productId);
|
|
} |