Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

ProductModel.cs

using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc.Rendering;
using Nop.Web.Areas.Admin.Models.Settings;
using Nop.Web.Framework.Models;
using Nop.Web.Framework.Mvc.ModelBinding;

namespace Nop.Web.Areas.Admin.Models.Catalog;

/// 
/// Represents a product model
/// 
public partial record ProductModel : BaseNopEntityModel,
    IAclSupportedModel, IDiscountSupportedModel, ILocalizedModel, IStoreMappingSupportedModel
{
    #region Ctor

    public ProductModel()
    {
        ProductPictureModels = new List();
        ProductVideoModels = new List();
        Locales = new List();
        CopyProductModel = new CopyProductModel();
        AddPictureModel = new ProductPictureModel();
        AddVideoModel = new ProductVideoModel();
        ProductWarehouseInventoryModels = new List();
        ProductEditorSettingsModel = new ProductEditorSettingsModel();
        StockQuantityHistory = new StockQuantityHistoryModel();

        AvailableBasepriceUnits = new List();
        AvailableBasepriceBaseUnits = new List();
        AvailableProductTemplates = new List();
        AvailableTaxCategories = new List();
        AvailableDeliveryDates = new List();
        AvailableProductAvailabilityRanges = new List();
        AvailableWarehouses = new List();
        ProductsTypesSupportedByProductTemplates = new Dictionary>();

        AvailableVendors = new List();

        SelectedStoreIds = new List();
        AvailableStores = new List();

        SelectedManufacturerIds = new List();
        AvailableManufacturers = new List();

        SelectedCategoryIds = new List();
        AvailableCategories = new List();

        SelectedCustomerRoleIds = new List();
        AvailableCustomerRoles = new List();

        SelectedDiscountIds = new List();
        AvailableDiscounts = new List();

        AvailableProductTags = new List();
        SelectedProductTags = new List();

        RelatedProductSearchModel = new RelatedProductSearchModel();
        CrossSellProductSearchModel = new CrossSellProductSearchModel();
        AssociatedProductSearchModel = new AssociatedProductSearchModel();
        ProductPictureSearchModel = new ProductPictureSearchModel();
        ProductVideoSearchModel = new ProductVideoSearchModel();
        ProductSpecificationAttributeSearchModel = new ProductSpecificationAttributeSearchModel();
        ProductOrderSearchModel = new ProductOrderSearchModel();
        TierPriceSearchModel = new TierPriceSearchModel();
        StockQuantityHistorySearchModel = new StockQuantityHistorySearchModel();
        ProductAttributeMappingSearchModel = new ProductAttributeMappingSearchModel();
        ProductAttributeCombinationSearchModel = new ProductAttributeCombinationSearchModel();
    }

    #endregion

    #region Properties

    //picture thumbnail
    [NopResourceDisplayName("Admin.Catalog.Products.Fields.PictureThumbnailUrl")]
    public string PictureThumbnailUrl { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ProductType")]
    public int ProductTypeId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ProductType")]
    public string ProductTypeName { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AssociatedToProductName")]
    public int AssociatedToProductId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AssociatedToProductName")]
    public string AssociatedToProductName { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.VisibleIndividually")]
    public bool VisibleIndividually { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ProductTemplate")]
    public int ProductTemplateId { get; set; }
    public IList AvailableProductTemplates { get; set; }

    //
    public Dictionary> ProductsTypesSupportedByProductTemplates { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Name")]
    public string Name { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ShortDescription")]
    public string ShortDescription { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.FullDescription")]
    public string FullDescription { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AdminComment")]
    public string AdminComment { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ShowOnHomepage")]
    public bool ShowOnHomepage { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MetaKeywords")]
    public string MetaKeywords { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MetaDescription")]
    public string MetaDescription { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MetaTitle")]
    public string MetaTitle { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.SeName")]
    public string SeName { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AllowCustomerReviews")]
    public bool AllowCustomerReviews { get; set; }

    public IList AvailableProductTags { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ProductTags")]
    public IList SelectedProductTags { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Sku")]
    public string Sku { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ManufacturerPartNumber")]
    public string ManufacturerPartNumber { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.GTIN")]
    public virtual string Gtin { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.IsGiftCard")]
    public bool IsGiftCard { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.GiftCardType")]
    public int GiftCardTypeId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.OverriddenGiftCardAmount")]
    [UIHint("DecimalNullable")]
    public decimal? OverriddenGiftCardAmount { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.RequireOtherProducts")]
    public bool RequireOtherProducts { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.RequiredProductIds")]
    public string RequiredProductIds { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AutomaticallyAddRequiredProducts")]
    public bool AutomaticallyAddRequiredProducts { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.IsDownload")]
    public bool IsDownload { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Download")]
    [UIHint("Download")]
    public int DownloadId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.UnlimitedDownloads")]
    public bool UnlimitedDownloads { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MaxNumberOfDownloads")]
    public int MaxNumberOfDownloads { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DownloadExpirationDays")]
    [UIHint("Int32Nullable")]
    public int? DownloadExpirationDays { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DownloadActivationType")]
    public int DownloadActivationTypeId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.HasSampleDownload")]
    public bool HasSampleDownload { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.SampleDownload")]
    [UIHint("Download")]
    public int SampleDownloadId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.HasUserAgreement")]
    public bool HasUserAgreement { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.UserAgreementText")]
    public string UserAgreementText { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.IsRecurring")]
    public bool IsRecurring { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.RecurringCycleLength")]
    public int RecurringCycleLength { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.RecurringCyclePeriod")]
    public int RecurringCyclePeriodId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.RecurringTotalCycles")]
    public int RecurringTotalCycles { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.IsRental")]
    public bool IsRental { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.RentalPriceLength")]
    public int RentalPriceLength { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.RentalPricePeriod")]
    public int RentalPricePeriodId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.IsShipEnabled")]
    public bool IsShipEnabled { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.IsFreeShipping")]
    public bool IsFreeShipping { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ShipSeparately")]
    public bool ShipSeparately { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AdditionalShippingCharge")]
    public decimal AdditionalShippingCharge { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DeliveryDate")]
    public int DeliveryDateId { get; set; }
    public IList AvailableDeliveryDates { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.IsTaxExempt")]
    public bool IsTaxExempt { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.TaxCategory")]
    public int TaxCategoryId { get; set; }
    public IList AvailableTaxCategories { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ManageInventoryMethod")]
    public int ManageInventoryMethodId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ProductAvailabilityRange")]
    public int ProductAvailabilityRangeId { get; set; }
    public IList AvailableProductAvailabilityRanges { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.UseMultipleWarehouses")]
    public bool UseMultipleWarehouses { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Warehouse")]
    public int WarehouseId { get; set; }
    public IList AvailableWarehouses { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.StockQuantity")]
    public int StockQuantity { get; set; }

    public int LastStockQuantity { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.StockQuantity")]
    public string StockQuantityStr { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DisplayStockAvailability")]
    public bool DisplayStockAvailability { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DisplayStockQuantity")]
    public bool DisplayStockQuantity { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MinStockQuantity")]
    public int MinStockQuantity { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.LowStockActivity")]
    public int LowStockActivityId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.NotifyAdminForQuantityBelow")]
    public int NotifyAdminForQuantityBelow { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.BackorderMode")]
    public int BackorderModeId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AllowBackInStockSubscriptions")]
    public bool AllowBackInStockSubscriptions { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.OrderMinimumQuantity")]
    public int OrderMinimumQuantity { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.OrderMaximumQuantity")]
    public int OrderMaximumQuantity { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AllowedQuantities")]
    public string AllowedQuantities { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AllowAddingOnlyExistingAttributeCombinations")]
    public bool AllowAddingOnlyExistingAttributeCombinations { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DisplayAttributeCombinationImagesOnly")]
    public bool DisplayAttributeCombinationImagesOnly { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.NotReturnable")]
    public bool NotReturnable { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DisableBuyButton")]
    public bool DisableBuyButton { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DisableWishlistButton")]
    public bool DisableWishlistButton { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AvailableForPreOrder")]
    public bool AvailableForPreOrder { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.PreOrderAvailabilityStartDateTimeUtc")]
    [UIHint("DateTimeNullable")]
    public DateTime? PreOrderAvailabilityStartDateTimeUtc { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.CallForPrice")]
    public bool CallForPrice { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Price")]
    public decimal Price { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.OldPrice")]
    public decimal OldPrice { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ProductCost")]
    public decimal ProductCost { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.CustomerEntersPrice")]
    public bool CustomerEntersPrice { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MinimumCustomerEnteredPrice")]
    public decimal MinimumCustomerEnteredPrice { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MaximumCustomerEnteredPrice")]
    public decimal MaximumCustomerEnteredPrice { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.BasepriceEnabled")]
    public bool BasepriceEnabled { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.BasepriceAmount")]
    public decimal BasepriceAmount { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.BasepriceUnit")]
    public int BasepriceUnitId { get; set; }
    public IList AvailableBasepriceUnits { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.BasepriceBaseAmount")]
    public decimal BasepriceBaseAmount { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.BasepriceBaseUnit")]
    public int BasepriceBaseUnitId { get; set; }
    public IList AvailableBasepriceBaseUnits { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MarkAsNew")]
    public bool MarkAsNew { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MarkAsNewStartDateTimeUtc")]
    [UIHint("DateTimeNullable")]
    public DateTime? MarkAsNewStartDateTimeUtc { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MarkAsNewEndDateTimeUtc")]
    [UIHint("DateTimeNullable")]
    public DateTime? MarkAsNewEndDateTimeUtc { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Weight")]
    public decimal Weight { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Length")]
    public decimal Length { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Width")]
    public decimal Width { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Height")]
    public decimal Height { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AvailableStartDateTime")]
    [UIHint("DateTimeNullable")]
    public DateTime? AvailableStartDateTimeUtc { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AvailableEndDateTime")]
    [UIHint("DateTimeNullable")]
    public DateTime? AvailableEndDateTimeUtc { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.DisplayOrder")]
    public int DisplayOrder { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Published")]
    public bool Published { get; set; }

    public string PrimaryStoreCurrencyCode { get; set; }

    public string BaseDimensionIn { get; set; }

    public string BaseWeightIn { get; set; }

    public IList Locales { get; set; }

    //ACL (customer roles)
    [NopResourceDisplayName("Admin.Catalog.Products.Fields.AclCustomerRoles")]
    public IList SelectedCustomerRoleIds { get; set; }
    public IList AvailableCustomerRoles { get; set; }

    //store mapping
    [NopResourceDisplayName("Admin.Catalog.Products.Fields.LimitedToStores")]
    public IList SelectedStoreIds { get; set; }
    public IList AvailableStores { get; set; }

    //categories
    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Categories")]
    public IList SelectedCategoryIds { get; set; }
    public IList AvailableCategories { get; set; }

    //manufacturers
    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Manufacturers")]
    public IList SelectedManufacturerIds { get; set; }
    public IList AvailableManufacturers { get; set; }

    //vendors
    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Vendor")]
    public int VendorId { get; set; }
    public IList AvailableVendors { get; set; }

    //discounts
    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Discounts")]
    public IList SelectedDiscountIds { get; set; }
    public IList AvailableDiscounts { get; set; }

    //vendor
    public bool IsLoggedInAsVendor { get; set; }

    //pictures
    public ProductPictureModel AddPictureModel { get; set; }
    public IList ProductPictureModels { get; set; }

    //videos
    public ProductVideoModel AddVideoModel { get; set; }
    public IList ProductVideoModels { get; set; }

    //product attributes
    public bool ProductAttributesExist { get; set; }
    public bool CanCreateCombinations { get; set; }

    //multiple warehouses
    [NopResourceDisplayName("Admin.Catalog.Products.ProductWarehouseInventory")]
    public IList ProductWarehouseInventoryModels { get; set; }

    //specification attributes
    public bool HasAvailableSpecificationAttributes { get; set; }

    //copy product
    public CopyProductModel CopyProductModel { get; set; }

    //editor settings
    public ProductEditorSettingsModel ProductEditorSettingsModel { get; set; }

    //stock quantity history
    public StockQuantityHistoryModel StockQuantityHistory { get; set; }

    public RelatedProductSearchModel RelatedProductSearchModel { get; set; }

    public CrossSellProductSearchModel CrossSellProductSearchModel { get; set; }

    public AssociatedProductSearchModel AssociatedProductSearchModel { get; set; }

    public ProductPictureSearchModel ProductPictureSearchModel { get; set; }

    public ProductVideoSearchModel ProductVideoSearchModel { get; set; }

    public ProductSpecificationAttributeSearchModel ProductSpecificationAttributeSearchModel { get; set; }

    public ProductOrderSearchModel ProductOrderSearchModel { get; set; }

    public TierPriceSearchModel TierPriceSearchModel { get; set; }

    public StockQuantityHistorySearchModel StockQuantityHistorySearchModel { get; set; }

    public ProductAttributeMappingSearchModel ProductAttributeMappingSearchModel { get; set; }

    public ProductAttributeCombinationSearchModel ProductAttributeCombinationSearchModel { get; set; }

    #endregion
}

public partial record ProductLocalizedModel : ILocalizedLocaleModel
{
    public int LanguageId { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.Name")]
    public string Name { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.ShortDescription")]
    public string ShortDescription { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.FullDescription")]
    public string FullDescription { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MetaKeywords")]
    public string MetaKeywords { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MetaDescription")]
    public string MetaDescription { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.MetaTitle")]
    public string MetaTitle { get; set; }

    [NopResourceDisplayName("Admin.Catalog.Products.Fields.SeName")]
    public string SeName { get; set; }
}