Exemplo n.º 1
0
        public ActionResult Listing()
        {
            AccomodationTypesListingModel model = new AccomodationTypesListingModel();

            model.AccomodationTypes = accomodationTypesService.GetAllAccomodationTypes();
            return(PartialView("_Listing", model));
        }
Exemplo n.º 2
0
        // GET: Deshboard/AccomodationTypes
        public ActionResult Index(string searchTerm)
        {
            AccomodationTypesListingModel model = new AccomodationTypesListingModel();

            model.SearchTerm        = searchTerm;
            model.AccomodationTypes = accomodationTypesService.SearchAccomodationTypes(searchTerm);
            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Listing(string search, int?accomodationTypeID, int?page)
        {
            page = page ?? 1;
            var viewModel         = new AccomodationTypesListingModel();
            var accomodationTypes = _service.GetAllAccomodationTypes();

            viewModel.AccomodationTypes = accomodationTypes;
            if (!string.IsNullOrEmpty(search))
            {
                viewModel.AccomodationTypes = viewModel.AccomodationTypes.Where(a => a.Name.ToLower().Contains(search.ToLower())).ToList();
            }

            viewModel.Pager = new PagerViewModel(viewModel.AccomodationTypes.Count, page, 3);
            var skip = (page.Value - 1) * 2;            // 3 is the records to skip..

            viewModel.AccomodationTypes = viewModel.AccomodationTypes.OrderBy(a => a.ID).Skip(skip).Take(2).ToList();
            return(PartialView("_Listing", viewModel));
        }