Exemple #1
0
        public PartialViewResult AddCarousel()
        {
            CarouselIM vCarousel = new CarouselIM {
                Active     = true,
                Importance = 0
            };

            var positionList = _positionService.GetAll().OrderByDescending(c => c.Importance).ToList();
            var positions    = new SelectList(positionList, "Id", "TitleAndSize");

            ViewBag.Positions = positions;

            return(PartialView("_AddCarousel", vCarousel));
        }
Exemple #2
0
        public JsonResult Edit(CarouselIM vm)
        {
            if (!ModelState.IsValid)
            {
                AR.Setfailure(GetModelErrorMessage());
                return(Json(AR, JsonRequestBehavior.DenyGet));
            }


            var carousel = _mapper.Map <Carousel>(vm);

            _carouselService.Update(carousel);
            carousel.Position = _positionService.GetById(carousel.PositionId);

            // var carouselVM = _mapper.Map<CarouselVM>(_carouselService.GetByIdWithPosition(carousel.Id));
            AR.Id   = carousel.Id;
            AR.Data = RenderPartialViewToString("_CarouselItem", carousel);

            return(Json(AR, JsonRequestBehavior.DenyGet));
        }
Exemple #3
0
        public JsonResult AddCarousel(CarouselIM vm)
        {
            if (!ModelState.IsValid)
            {
                AR.Setfailure(GetModelErrorMessage());
                return(Json(AR, JsonRequestBehavior.DenyGet));
            }

            var carousel = _mapper.Map <Carousel>(vm);

            _carouselService.Create(carousel);

            int count;
            int pageSize = SettingsManager.Ads.PageSize;
            var list     = _carouselService.GetPagedElements(0, pageSize, string.Empty, 0, out count);

            //  List<CarouselVM> carouselList = _mapper.Map<List<Carousel>, List<CarouselVM>>(list);
            AR.Data = RenderPartialViewToString("_CarouselList", list);

            return(Json(AR, JsonRequestBehavior.DenyGet));
        }