Webiant Logo Webiant Logo
  1. No results found.

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

ManufacturerTemplateService.cs

using Nop.Core.Domain.Catalog;
using Nop.Data;

namespace Nop.Services.Catalog;

/// 
/// Manufacturer template service
/// 
public partial class ManufacturerTemplateService : IManufacturerTemplateService
{
    #region Fields

    protected readonly IRepository _manufacturerTemplateRepository;

    #endregion

    #region Ctor

    public ManufacturerTemplateService(IRepository manufacturerTemplateRepository)
    {
        _manufacturerTemplateRepository = manufacturerTemplateRepository;
    }

    #endregion

    #region Methods

    /// 
    /// Delete manufacturer template
    /// 
    /// Manufacturer template
    /// A task that represents the asynchronous operation
    public virtual async Task DeleteManufacturerTemplateAsync(ManufacturerTemplate manufacturerTemplate)
    {
        await _manufacturerTemplateRepository.DeleteAsync(manufacturerTemplate);
    }

    /// 
    /// Gets all manufacturer templates
    /// 
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the manufacturer templates
    /// 
    public virtual async Task> GetAllManufacturerTemplatesAsync()
    {
        var templates = await _manufacturerTemplateRepository.GetAllAsync(query =>
        {
            return from pt in query
                orderby pt.DisplayOrder, pt.Id
                select pt;
        }, cache => default);

        return templates;
    }

    /// 
    /// Gets a manufacturer template
    /// 
    /// Manufacturer template identifier
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the manufacturer template
    /// 
    public virtual async Task GetManufacturerTemplateByIdAsync(int manufacturerTemplateId)
    {
        return await _manufacturerTemplateRepository.GetByIdAsync(manufacturerTemplateId, cache => default);
    }

    /// 
    /// Inserts manufacturer template
    /// 
    /// Manufacturer template
    /// A task that represents the asynchronous operation
    public virtual async Task InsertManufacturerTemplateAsync(ManufacturerTemplate manufacturerTemplate)
    {
        await _manufacturerTemplateRepository.InsertAsync(manufacturerTemplate);
    }

    /// 
    /// Updates the manufacturer template
    /// 
    /// Manufacturer template
    /// A task that represents the asynchronous operation
    public virtual async Task UpdateManufacturerTemplateAsync(ManufacturerTemplate manufacturerTemplate)
    {
        await _manufacturerTemplateRepository.UpdateAsync(manufacturerTemplate);
    }

    #endregion
}