52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using MAX.Core.Commons;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Store.Product.Models.Product
|
|
{
|
|
/// <summary>
|
|
/// 商品属性
|
|
/// </summary>
|
|
public partial class ProductPropertys : List<CommonKeyValue>
|
|
{
|
|
/// <summary>
|
|
/// 是否存在Key
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
public bool ContainsKey(string key)
|
|
{
|
|
return Exists(a => a.Key == key);
|
|
}
|
|
/// <summary>
|
|
/// 添加数据
|
|
/// </summary>
|
|
/// <param name="Key"></param>
|
|
/// <param name="Value"></param>
|
|
public void Add(string Key, string Value)
|
|
{
|
|
if (!ContainsKey(Key))
|
|
{
|
|
Add(new CommonKeyValue() { Key = Key, Value = Value });
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 获取值
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
public string GetValue(string key)
|
|
{
|
|
if (ContainsKey(key))
|
|
{
|
|
CommonKeyValue p = this.FirstOrDefault(a => a.Key == key);
|
|
return p.Value;
|
|
}
|
|
return "";
|
|
}
|
|
}
|
|
}
|