Files
Core_Be/Models/Product.cs
T
HarithaRandunu 2eb88b058e Add inventory management features including Sales, Stock Returns, and Suppliers
- Implement Sale and SaleItem models for tracking sales transactions.
- Create StockReturn model to manage stock adjustments for various reasons.
- Introduce Supplier model to represent suppliers of products.
- Develop InventoryRepository for CRUD operations on products, suppliers, sales, and stock returns.
- Implement InventoryService to handle business logic for inventory management.
- Update TenantDbContext to include new models and relationships.
- Enhance ProfitLossRepository to account for sales, purchases, and stock returns in profit and loss calculations.
- Modify Program.cs to register new inventory-related services.
2026-10-07 15:43:20 +05:30

44 lines
1.5 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Fitness_core_BE.Models
{
/// <summary>A stocked item sold at the gym (snacks, supplements, merchandise). QuantityOnHand
/// is a maintained running balance -- adjusted by GoodsReceivedNoteItem (+), SaleItem (-) and
/// StockReturn (-) -- not computed from those tables on every read.</summary>
public class Product
{
[Key]
public Guid ProductId { get; set; }
public Guid FKClientId { get; set; }
[ForeignKey(nameof(FKClientId))]
public Client Client { get; set; }
[MaxLength(128)]
public string Name { get; set; } = string.Empty;
[MaxLength(64)]
public string? Sku { get; set; }
/// <summary>Relative /Uploads path to the product's photo (same convention as
/// ClientBusiness.BusinessLogoId) -- null when no image has been uploaded.</summary>
[MaxLength(300)]
public string? ImageId { get; set; }
[MaxLength(20)]
public string UnitOfMeasure { get; set; } = "pcs";
/// <summary>Set from the most recent GRN line's UnitCost -- a simple latest-cost
/// approach, not a weighted average.</summary>
public decimal CostPrice { get; set; } = 0m;
public decimal SellingPrice { get; set; } = 0m;
public decimal QuantityOnHand { get; set; } = 0m;
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
}