Ejemplo n.º 1
0
        public void SaveCustomRedirect(CustomRedirect currentCustomRedirect)
        {
            var store = DataStoreFactory.GetStore(typeof(CustomRedirect));
            var match = store.Find <CustomRedirect>(OldUrlPropertyName, currentCustomRedirect.OldUrl.ToLower()).SingleOrDefault();

            //if there is a match, replace the value.
            if (match != null)
            {
                store.Save(currentCustomRedirect, match.Id);
            }
            else
            {
                store.Save(currentCustomRedirect);
            }
        }
Ejemplo n.º 2
0
        public void SaveCustomRedirect(CustomRedirect currentCustomRedirect)
        {
            // Get hold of the datastore
            DynamicDataStore store = DataStoreFactory.GetStore(typeof(CustomRedirect));
            //check if there is an exisiting object with matching property "OldUrl"
            CustomRedirect match = store.Find <CustomRedirect>(OLD_URL_PROPERTY_NAME, currentCustomRedirect.OldUrl.ToLower()).SingleOrDefault();

            //if there is a match, replace the value.
            if (match != null)
            {
                store.Save(currentCustomRedirect, match.Id);
            }
            else
            {
                store.Save(currentCustomRedirect);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns a list of all CustomRedirect objects in the Dynamic Data Store.
        /// </summary>
        /// <returns></returns>
        public List <CustomRedirect> GetCustomRedirects(bool excludeIgnored)
        {
            var store = DataStoreFactory.GetStore(typeof(CustomRedirect));
            IEnumerable <CustomRedirect> customRedirects;

            if (excludeIgnored)
            {
                customRedirects = from s in store.Items <CustomRedirect>().OrderBy(cr => cr.OldUrl)
                                  where s.State.Equals((int)State.Saved)
                                  select s;
            }
            else
            {
                customRedirects = from s in store.Items <CustomRedirect>().OrderBy(cr => cr.OldUrl)
                                  select s;
            }
            return(customRedirects.ToList());
        }