/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> public LocationIndoor CreateLocationIndoor(LocationIndoor obj) { var user = CfPerfCache.GetClimber(CfIdentity.UserID); CreateLocationIndoorAuthorization(obj); obj.NameUrlPart = obj.Name.ToUrlFriendlyString(); locIndoorRepo.Create(obj); var meta = objModMetaRepo.Create(new ObjectModMeta(obj, currentUser.UserID)); //-- Refresh the cache AppLookups.AddIndexEntryToCache( obj.ToCacheIndexEntry() ); ClaimObject(obj); //-- Save post for the feed //PostService.CreateLocationCreatedPost(obj); var action = SaveModActionAndUpdateModProfile(ModActionType.LocationIndoorAdd, null, obj, meta, (m, actionID) => m.SetCreated(actionID), mp => mp.PlacesAdded++, "added {0} {1}", obj.Type, obj.Name); postSvc.CreateContentAddPost(action, obj.ID, user.PrivacyPostsDefaultIsPublic); //-- TODO: Calculate all areas that completely contain this area + Shoot off a notification to moderators return obj; }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> public LocationIndoor CreateLocationIndoor(LocationIndoor obj) { var user = CfPerfCache.GetClimber(CfIdentity.UserID); CreateLocationIndoorAuthorization(obj); obj.NameUrlPart = obj.Name.ToUrlFriendlyString(); locIndoorRepo.Create(obj); var meta = objModMetaRepo.Create(new ObjectModMeta(obj, currentUser.UserID)); //-- Refresh the cache AppLookups.AddIndexEntryToCache(obj.ToCacheIndexEntry()); ClaimObject(obj); //-- Save post for the feed //PostService.CreateLocationCreatedPost(obj); var action = SaveModActionAndUpdateModProfile(ModActionType.LocationIndoorAdd, null, obj, meta, (m, actionID) => m.SetCreated(actionID), mp => mp.PlacesAdded++, "added {0} {1}", obj.Type, obj.Name); postSvc.CreateContentAddPost(action, obj.ID, user.PrivacyPostsDefaultIsPublic); //-- TODO: Calculate all areas that completely contain this area + Shoot off a notification to moderators return(obj); }
/// <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); }
/// <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; }