panjamin
2/24/2020 - 4:13 AM

必填字段检查

#region 必填检查
ArrayList checkList = new ArrayList
{
        new ValidType<string>("ProductName", obj.ProductName),
        new ValidType<DateTime?>("ValidDateFrom", obj.ValidDateFrom),
        new ValidType<DateTime?>("ValidDateTo", obj.ValidDateTo),
        new ValidType<int?>("ClassCount", obj.ClassCount),
        new ValidType<decimal?>("PricePerLesson", obj.PricePerLesson),
        new ValidType<string>("ProductType", obj.ProductType),
        new ValidType<string>("City", obj.City)
};

bool isConentNull = ValidHelper.CheckValueIsNull(checkList, out _error);
if (isConentNull)
{
    return Result.ContentResultErrorJson(_error);
}
#endregion