Skip to content

循环执行单次更新时,ResetTable应该在foreach内部还是外部? #65

@WuTian-UX

Description

@WuTian-UX

循环执行单次更新时(不是批量更新),ResetTable应该在foreach内部还是外部?

private bool UpdateTongHuiRepaymentScheduleList(MAction action, List<UpdateTongHuiRepaymentScheduleListInput> listInput, string scheduleId)
{
	foreach (var listItem in listInput)
	{
		action.ResetTable("TongHuiRepaymentScheduleList");
		action.Set("CurrentPayState", listItem.CurrentPayState);
		action.Set("CurrentBuyBackState", listItem.CurrentBuyBackState);
		action.Set("CurrentCompensatoryState", listItem.CurrentCompensatoryState);
		action.Set("CustomerPayState", listItem.CustomerPayState);
		action.Set("THPayableId", listItem.THPayableId);
		
		if (!action.Update(listItem.Id))
		{
			return false; // 如果插入失败,返回 false
		}
	}
	return true; // 如果所有插入成功,返回 true
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions