/// <summary> /// /// </summary> /// <param name="original"></param> /// <param name="updated"></param> /// <returns></returns> public LocationIndoor UpdateLocationIndoor(LocationIndoor original, LocationIndoor updated) { var placeMeta = UpdateLocationIndoorAuthorization(original, updated); if (!original.Equals(updated)) { locIndoorRepo.Update(updated); AppLookups.UpdateIndexEntryInCache(updated.ToCacheIndexEntry()); var action = SaveModActionAndUpdateModProfile(ModActionType.LocationIndoorEdit, original, updated, placeMeta, (m, actionID) => m.SetDetailsChanged(actionID), null, "edited {0} {1}", updated.Type, updated.Name); postSvc.UpdateContentAddPost(action); } return(updated); }
private T UpdateClimb <T>(T original, T updated, List <int> categories, Func <T, T> updateClimbToDb) where T : Climb, new() { var meta = UpdateClimbAuthorization(original, updated, categories); //-- if (!original.Equals(updated)) { updated.GradeCfNormalize = GradeConvert(updated.GradeLocal); if (string.IsNullOrWhiteSpace(updated.NameShort)) { updated.NameShort = string.Empty; } if (updated.SetterID == Guid.Empty) { updated.SetterID = null; } updateClimbToDb(updated); AppLookups.UpdateIndexEntryInCache(updated.ToCacheIndexEntry()); //-- We don't want to save mod trail if it's indoor (the setters working, kinda boring!) if (updated.Type == CfType.ClimbOutdoor) { var action = SaveModActionAndUpdateModProfile(ModActionType.ClimbEdit, original, updated, meta, (m, actionID) => m.SetDetailsChanged(actionID), null, "edited climb {0}", updated.Name); postSvc.UpdateContentAddPost(action); } } //-- Can't be bothered logging/showing if only the categories were changed if (categoryListsDoNotMatch(original.ClimbTags, categories)) { climbRepo.UpdateCategories(updated, categories); } return(updated); }
/// <summary> /// /// </summary> /// <param name="original"></param> /// <param name="updated"></param> /// <returns></returns> public Area UpdateArea(Area original, Area updated) { var meta = UpdateAreaAuthorization(original, updated); if (!original.Equals(updated)) { areaRepo.Update(updated); //-- Refresh the cache AppLookups.UpdateIndexEntryInCache(updated.ToCacheIndexEntry()); //-- Send off notifications var action = SaveModActionAndUpdateModProfile(ModActionType.AreaEdit, original, updated, meta, (m, actionID) => m.SetDetailsChanged(actionID), null, "edited {0} {1}", updated.Type, updated.Name); postSvc.UpdateContentAddPost(action); } return(updated); }