public void DeleteUrl(VanityUrlInfo VanityUrl)
 {
     if (ValidateAuthentication())
     {
         VanityUrlController.DeleteUrl(VanityUrl);
     }
 }
 public VanityUrlInfo SaveUrl(VanityUrlInfo VanityUrl)
 {
     if (ValidateAuthentication())
     {
         return VanityUrlController.SaveUrl(VanityUrl);
     }
     return null;
 }
 /// <summary>
 /// Deletes the URL.
 /// </summary>
 /// <param name="v">The v.</param>
 public static void DeleteUrl(VanityUrlInfo v)
 {
     DataProvider.Instance().ExecuteNonQuery(Constants.DbPrefix + "Delete_Url", v.ID);
     UpdateCache(v,PortalSettings.Current.PortalId);
 }
 /// <summary>
 /// Updates the cache.
 /// </summary>
 /// <param name="v">The v.</param>
 /// <param name="PortalId">The portal id.</param>
 /// <param name="add">if set to <c>true</c> [add].</param>
 private static void UpdateCache(VanityUrlInfo v, int PortalId, bool add = false)
 {
     List<VanityUrlInfo> cache = DataCache.GetCache(Constants.ModuleCacheKey + string.Format(Constants.LinksCacheKey, PortalId)) as List<VanityUrlInfo>;
     if (cache != null)
     {
         cache.RemoveAll(x => x.ID == v.ID);
         if(add)
             cache.Add(v);
         var timeOut = Convert.ToInt32(Host.PerformanceSetting);
         DataCache.SetCache(Constants.ModuleCacheKey + string.Format(Constants.LinksCacheKey, PortalId), cache, TimeSpan.FromMinutes(timeOut));
     }
 }
 /// <summary>
 /// Updates the last accessed date.
 /// </summary>
 /// <param name="v">The v.</param>
 /// <param name="PortalId">The portal id.</param>
 public static void UpdateLastAccessedDate(VanityUrlInfo v, int PortalId)
 {
     DataProvider.Instance().ExecuteNonQuery(Constants.DbPrefix + "Update_LastAccessed", v.ID);
     v.LastAccessedDate = DateTime.Now;
     UpdateCache(v, PortalId, true);
 }
 /// <summary>
 /// Saves the URL.
 /// </summary>
 /// <param name="v">The v.</param>
 /// <returns>VanityUrlInfo.</returns>
 public static VanityUrlInfo SaveUrl(VanityUrlInfo v)
 {
     v.ModifiedOnDate = DateTime.Now;
     v.ModifiedByUserId = UserController.GetCurrentUserInfo().UserID;
     v = CBO.FillObject<VanityUrlInfo>(
                 DataProvider.Instance()
                             .ExecuteReader(Constants.DbPrefix + "Update_Url", v.ID, PortalSettings.Current.PortalId, v.VanityUrl, v.RedirectUrl,
                                            v.Description, v.ActiveStartDate, v.ActiveEndDate, v.ModifiedByUserId,
                                            v.ModifiedOnDate));
     UpdateCache(v,PortalSettings.Current.PortalId, true);
     return v;
 }