Esempio n. 1
0
        public RedirectRule GetRedirect(int id)
        {
            var rule = _repository.Get(id);

            return(rule == null ? null :
                   RedirectRule.Copy(rule));
        }
        public IEnumerable <RedirectRule> GetRedirects(int startIndex = 0, int pageSize = 0)
        {
            var result = _repository.Table.Skip(startIndex >= 0 ? startIndex : 0);

            if (pageSize > 0)
            {
                return(RedirectRule.Copy(result.Take(pageSize)));
            }
            return(RedirectRule.Copy(result.ToList()));
        }
Esempio n. 3
0
 public RedirectRule GetRedirect(string path)
 {
     //path = path.TrimStart('/');
     try {
         var rule = _repository.Get(x => x.SourceUrl == path);
         return(rule == null ? null :
                RedirectRule.Copy(rule));
     } catch (Exception) {
         //sqlCE doe not support using strings properly when their length is such that the column
         //in the record is of type ntext.
         var rules = _repository.Fetch(rr =>
                                       rr.SourceUrl.StartsWith(path) && rr.SourceUrl.EndsWith(path));
         var rule = rules.ToList().Where(rr => rr.SourceUrl == path).FirstOrDefault();
         return(rule == null ? null :
                RedirectRule.Copy(rule));
     }
 }
 public IEnumerable <RedirectRule> GetRedirects(int[] itemIds)
 {
     return(RedirectRule.Copy(_repository.Fetch(x => itemIds.Contains(x.Id))));
 }