示例#1
0
 public ActionResult Index(int?offset)
 {
     ViewData["PostyTagi"]  = _postTag.pobierzPorcje(Int16.Parse(_ustawienia.getSettings("ilosc_pozycji_na_strone")), (offset == null || offset == 0)?0:(int)offset - 1);
     ViewData["Komentarze"] = _komentarze.PobierzWszystkie();
     //Lista(aktywna strona, liczba postow, elementów w porcji)
     ViewData["Nawigacja"] = new List <int> {
         (offset == null || offset == 0) ? 1 : (int)offset, _postTag.ileWszystkichAktywnych(), Int16.Parse(_ustawienia.getSettings("ilosc_pozycji_na_strone"))
     };
     return(View());
 }
示例#2
0
        public string getSettings(string key)
        {
            #region walidacja
            if (String.IsNullOrEmpty(key))
            {
                throw new ArgumentException("Klucz nie może być pusty", key);
            }
            if (String.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentException("Klucz nie może zawierać białych znaków", key);
            }
            if (!existSettings(key))
            {
                throw new ArgumentException("Podany klucz: " + key + " nie istnieje", key);
            }
            #endregion

            return(_ustawienia.getSettings(key));
        }