Ejemplo n.º 1
0
        /// <summary>
        /// Here we keep track of all the moderator happenings & associated post content
        /// </summary>
        /// <param name="obj"></param>
        public void DeleteClimbOutdoor(ClimbOutdoor obj)
        {
            var meta = DeleteClimbOutdoorAuthorization(obj);

            DeleteClimb(obj);

            var modWhoAdded = modProfileRepo.GetByID(meta.CreatedByUserID);

            if (modWhoAdded.ClimbsAdded > 0)
            {
                modWhoAdded.ClimbsAdded--;
                modProfileRepo.Update(modWhoAdded);

                //-- Remove the points associated with this place
                var actionsWithPoints = modActionRepo.GetAll().Where(a => a.OnObjectID == meta.ID);
                ReverseActions(actionsWithPoints);
            }

            //-- update the principal details with the details we just updated (if they are the same person who deleted it)
            CfPrincipal.AttachModProfile(modProfileRepo.GetByID(currentUser.UserID));
            meta.Name = obj.Name;

            var action = SaveModActionAndUpdateModProfile(ModActionType.ClimbDelete, obj, null, meta,
                                                          (m, actionID) => m.SetDeleted(actionID), null, "deleted climb {0}", obj.Name);

            postSvc.DeleteContentAddPost(action);
            //-- TODO: Shoot off notifications to claimed users
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        public void DeleteArea(Area obj)
        {
            var meta = DeleteAreaAuthorization(obj);

            //-- TODO: Shoot off notifications

            areaRepo.Delete(obj);

            //-- Update the cache
            AppLookups.RemoveCacheIndexEntry(obj.ID);

            var modWhoAddedArea = modProfileRepo.GetByID(meta.CreatedByUserID);

            if (modWhoAddedArea.PlacesAdded > 0)
            {
                modWhoAddedArea.PlacesAdded--;
                modProfileRepo.Update(modWhoAddedArea);

                //-- Remove the points associated with this place
                var actionsWithPoints = modActionRepo.GetAll().Where(a => a.OnObjectID == meta.ID);
                ReverseActions(actionsWithPoints);
            }

            //-- update the principal details with the details we just updated (if they are the same person who deleted it)
            CfPrincipal.AttachModProfile(modProfileRepo.GetByID(currentUser.UserID));

            meta.Name = obj.VerboseDisplayName;

            var action = SaveModActionAndUpdateModProfile(ModActionType.AreaDelete, obj, null, meta,
                                                          (m, actionID) => m.SetDeleted(actionID), null, "deleted {0} {1}", obj.Type, obj.Name);

            postSvc.DeleteContentAddPost(action);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        public void DeleteLocationIndoor(LocationIndoor obj)
        {
            var meta = DeleteLocationIndoorAuthorization(obj);

            locIndoorRepo.Delete(obj.ID);

            //-- Update the cache
            AppLookups.RemoveCacheIndexEntry(obj.ID);

            var modWhoAddedArea = modProfileRepo.GetByID(meta.CreatedByUserID);

            if (modWhoAddedArea.PlacesAdded > 0)
            {
                modWhoAddedArea.PlacesAdded--;
                modProfileRepo.Update(modWhoAddedArea);

                //-- Remove the points associated with this place
                var actionsWithPoints = modActionRepo.GetAll().Where(a => a.OnObjectID == meta.ID);
                ReverseActions(actionsWithPoints);
            }

            //-- update the principal details with the details we just updated (if they are the same person who deleted it)
            CfPrincipal.AttachModProfile(modProfileRepo.GetByID(currentUser.UserID));

            //-- Incase the name changed during the life of the object, we want to save the meta with the same name as the object was when it was deleted.
            meta.Name = obj.VerboseDisplayName;

            var action = SaveModActionAndUpdateModProfile(ModActionType.LocationIndoorDelete, obj, null, meta,
                                                          (m, actionID) => m.SetDeleted(actionID), null, "deleted {0} {1}", obj.Type, obj.Name);

            postSvc.DeleteContentAddPost(action);
        }
 public void SetModDetailsOnPrincipal()
 {
     if (CfPrincipal.ModDetails == null)
     {
         var modProfile = GetModProfile(currentUserID);
         CfPrincipal.AttachModProfile(modProfile);
     }
 }
Ejemplo n.º 5
0
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     if (filterContext.HttpContext.User.Identity.IsAuthenticated)
     {
         var modProfile = new GeoService().GetModProfile(CfIdentity.UserID);
         if (modProfile != null)
         {
             CfPrincipal.AttachModProfile(modProfile);
         }
     }
 }