This project is read-only.
2
Vote

IsEnabled Not Stored to Database - Fix Included

description

I downloaded your most recent release (from source code) and could not get the "IsEnabled" to work properly. I looked at the DriverResult Editor (for //Post) and found that the part TryUpdateModel was being set before the part.IsEnabled was set (so my theory is that the part was never getting the informatioin from the form). Anyway, I had to change from this:

// Update main bits of location
var ok = updater.TryUpdateModel(part, Prefix, null, null);

// Update linked maplist bit of location
var model = new EditBingLocationViewModel();
updater.TryUpdateModel(model, Prefix, null, null);

// Gets value from String version (means it also works in French)
part.Latitude = model.Latitude;
part.Longitude = model.Longitude;

part.IsEnabled = model.IsEnabled;

to this:

// Update linked maplist bit of location
var model = new EditBingLocationViewModel();
updater.TryUpdateModel(model, Prefix, null, null);

// Gets value from String version (means it also works in French)
part.Latitude = model.Latitude;
part.Longitude = model.Longitude;

part.IsEnabled = model.IsEnabled;

// Update main bits of location
var ok = updater.TryUpdateModel(part, Prefix, null, null);

By switching the part TryUpdateModel at the end, everything seems to be working fine.

comments

RichardGarside wrote Jul 14, 2014 at 11:39 AM

I've not been able to reproduce this issue, but I did realise that IsEnabled doesn't need to be set explicitly like it is. The updater deals with this. The only reason long and lat are set is to deal with localisation issues for locales that use commas instead of periods as a decimal point.

So I've removed this from the driver in commit c6f2d5baa12a and 'it works fine on my machine'. Does it work on your machine?