| | |
| | | } |
| | | |
| | | Type detailType = typeof(TEntity).GetDetailType(); |
| | | MethodInfo? methodInfo = GetType().GetMethod("AddDataIncludesDetail"); |
| | | MethodInfo? methodInfo = GetType().GetMethod(nameof(AddDataIncludesDetail)); |
| | | methodInfo = methodInfo?.MakeGenericMethod(new Type[] { detailType }); |
| | | object? obj = methodInfo?.Invoke(this, new object[] { entity, detailType, saveModel.DetailData }); |
| | | return obj as WebResponseContent; |
| | |
| | | |
| | | TEntity entity = saveModel.MainData.DicToModel<TEntity>(); |
| | | |
| | | List<string> listCol = new List<string>(); |
| | | foreach (var item in saveModel.MainData) |
| | | { |
| | | PropertyInfo propertyInfo = typeof(TEntity).GetProperty(item.Key); |
| | | if (propertyInfo == null) |
| | | { |
| | | propertyInfo = typeof(TEntity).GetProperty(item.Key.FirstLetterToLower()); |
| | | if (propertyInfo == null) |
| | | { |
| | | propertyInfo = typeof(TEntity).GetProperty(item.Key.FirstLetterToUpper()); |
| | | } |
| | | } |
| | | //List<string> listCol = new List<string>(); |
| | | //foreach (var item in saveModel.MainData) |
| | | //{ |
| | | // PropertyInfo propertyInfo = typeof(TEntity).GetProperty(item.Key); |
| | | // if (propertyInfo == null) |
| | | // { |
| | | // propertyInfo = typeof(TEntity).GetProperty(item.Key.FirstLetterToLower()); |
| | | // if (propertyInfo == null) |
| | | // { |
| | | // propertyInfo = typeof(TEntity).GetProperty(item.Key.FirstLetterToUpper()); |
| | | // } |
| | | // } |
| | | |
| | | listCol.Add(propertyInfo?.Name); |
| | | } |
| | | // listCol.Add(propertyInfo?.Name); |
| | | //} |
| | | |
| | | if (saveModel.DetailData == null || saveModel.DetailData.Count == 0) |
| | | { |
| | | if (list != null) |
| | | listCol = listCol.Where(x => !list.Contains(x)).ToList(); |
| | | bool result = BaseDal.UpdateData(entity, listCol, list); |
| | | //if (list != null) |
| | | // listCol = listCol.Where(x => !list.Contains(x)).ToList(); |
| | | bool result = BaseDal.UpdateData(entity); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | Type detailType = typeof(TEntity).GetDetailType(); |
| | | MethodInfo? methodInfo = GetType().GetMethod("UpdateDataInculdesDetail"); |
| | | MethodInfo? methodInfo = GetType().GetMethod(nameof(UpdateDataInculdesDetail)); |
| | | methodInfo = methodInfo?.MakeGenericMethod(new Type[] { detailType }); |
| | | object? obj = methodInfo?.Invoke(this, new object[] { entity, detailType, saveModel.DetailData, saveModel.DelKeys }); |
| | | return obj as WebResponseContent; |