public async Task AddDataListAsync(DepartmentRelationInputDto data) { data.Department.ForEach(a => { Base_DepartmentRelation base_DepartmentRelation = new Base_DepartmentRelation(); base_DepartmentRelation.Id = IdHelper.GetId(); base_DepartmentRelation.OldDepartment = data.OldDepartment; base_DepartmentRelation.Department = a; base_DepartmentRelation.CreateTime = DateTime.Now; base_DepartmentRelation.CreatorName = _operator.Property.UserName; base_DepartmentRelation.CreatorId = _operator.UserId; Insert(base_DepartmentRelation); }); await Task.CompletedTask; }
public async Task UpdateDataListAsync(DepartmentRelationInputDto data) { data.Department.ForEach(a => { Base_DepartmentRelation base_DepartmentRelation = new Base_DepartmentRelation(); base_DepartmentRelation.Id = data.Id; base_DepartmentRelation.OldDepartment = data.OldDepartment; base_DepartmentRelation.Department = a; base_DepartmentRelation.UpdateTime = DateTime.Now; base_DepartmentRelation.UpdateName = _operator.Property.UserName; base_DepartmentRelation.UpdateId = _operator.UserId; Service.UpdateAny <Base_DepartmentRelation>(base_DepartmentRelation, new List <string>() { "OldDepartment", "Department", "UpdateTime", "UpdateName", "UpdateId" }); }); await Task.CompletedTask; }