Skip to content

Commit

Permalink
Fixes export profile never updated. MiniMapper too dangerous here:
Browse files Browse the repository at this point in the history
DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
InvalidOperationException: The relationship could not be changed because one or more of the foreign-key properties is non-nullable.
  • Loading branch information
mgesing committed Nov 11, 2020
1 parent 4e61648 commit b1f535a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,19 @@ public ActionResult Edit(ExportProfileModel model, bool continueEditing)
return View(model);
}

MiniMapper.Map(profile, model);

profile.Name = model.Name;
profile.FileNamePattern = model.FileNamePattern;
profile.FolderName = model.FolderName;
profile.Enabled = model.Enabled;
profile.ExportRelatedData = model.ExportRelatedData;
profile.Offset = model.Offset;
profile.Limit = model.Limit ?? 0;
profile.BatchSize = model.BatchSize ?? 0;
profile.PerStore = model.PerStore;
profile.CompletedEmailAddresses = string.Join(",", model.CompletedEmailAddresses ?? new string[0]);
profile.EmailAccountId = model.EmailAccountId ?? 0;
profile.CreateZipArchive = model.CreateZipArchive;
profile.Cleanup = model.Cleanup;

if (profile.Name.IsEmpty())
profile.Name = provider.Metadata.FriendlyName;
Expand All @@ -779,6 +786,7 @@ public ActionResult Edit(ExportProfileModel model, bool continueEditing)
projection.AppendDescriptionText = string.Join(",", model.Projection.AppendDescriptionText ?? new string[0]);
projection.RemoveCriticalCharacters = model.Projection.RemoveCriticalCharacters;
projection.CriticalCharacters = string.Join(",", model.Projection.CriticalCharacters ?? new string[0]);

profile.Projection = XmlHelper.Serialize(projection);
}

Expand All @@ -791,6 +799,7 @@ public ActionResult Edit(ExportProfileModel model, bool continueEditing)

filter.StoreId = model.Filter.StoreId ?? 0;
filter.CategoryIds = model.Filter.CategoryIds?.Where(x => x != 0)?.ToArray() ?? new int[0];

profile.Filtering = XmlHelper.Serialize(filter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<fieldset>
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Id)
@Html.HiddenFor(model => model.ProviderSystemName)

<div class="section-header">
<div class="title">
Expand Down

0 comments on commit b1f535a

Please sign in to comment.