public ActionResult Pamm(PammModel model)
 {
     FillPammModel(model);
     if (Request.IsAjaxRequest())
         return PartialView("PammPartialTable", model);
     return View("Pamm", model);
 }
 public ActionResult Pamm(string message)
 {
     var model = new PammModel();
     FillPammModel(model, true);
     if (Request.IsAjaxRequest())
         return PartialView("PammPartialTable", model);
     return View("Pamm", model);
 }
        public ActionResult PammDetails(PammItem pammItem)
        {
            var model = new PammModel();
            FillPammModel(model);

            if (Request.IsAjaxRequest())
                return PartialView("PammPartialTable", model);
            return View("Pamm", model);
        }
        private void FillPammModel(PammModel model, bool voidItems = false)
        {
            if (model == null) model = new PammModel();
            if (model.PageNomber < 0) model.PageNomber = 0;
            if (!model.PageSizeItems.Contains(model.CurrentPageSize)) model.CurrentPageSize = model.PageSizeItems.First();

            var result = voidItems ? new List<PammItem>() : pammRepository.GetAllPamm(model.AnyInvestor);
            model.CurrentPageItems = (result == null || voidItems) ? new PagedList<PammItem>(new List<PammItem>(), 0, 1) :
                                                                     new PagedList<PammItem>(result, model.PageNomber, model.CurrentPageSize);
        }