public HttpResponseMessage GetAll(HttpRequestMessage request) { Func <HttpResponseMessage> func = () => { var model = _slideService.GetAll(); var responseData = Mapper.Map <IEnumerable <Slide>, IEnumerable <SlideViewModel> >(model); var response = request.CreateResponse(HttpStatusCode.OK, responseData); return(response); }; return(CreateHttpResponse(request, func)); }
public ActionResult slide() { var modelProductHot = _productService.GetProductHot().Take(4); var modelSlide = _slideService.GetAll(); ViewBag.listSlide = Mapper.Map <IEnumerable <Slide>, IEnumerable <SlideViewModel> >(modelSlide); ViewBag.listProductHot = Mapper.Map <IEnumerable <Product>, IEnumerable <ProductViewModel> >(modelProductHot); return(PartialView()); }
public HttpResponseMessage GetAll(HttpRequestMessage request) { return(CreateHttpResponse(request, () => { IEnumerable <Slide> listSlideDb = _slideService.GetAll(); IEnumerable <SlideViewModel> listSlideVm = Mapper.Map <IEnumerable <SlideViewModel> >(listSlideDb); return request.CreateResponse(HttpStatusCode.OK, listSlideVm); })); }
public IActionResult Index() { ProductPromotionIndexViewModel promotion = new ProductPromotionIndexViewModel() { }; promotion.Slides = _slideService.GetAll(true); promotion.Advertistments = _advertistmentService.GetbyPageAndPosition(PageName.Orther, PositionName.Default); promotion.DomainApi = _config["DomainApi:Domain"]; promotion.Tags = _productService.GetAllTag(15); promotion.ProductCategorys = _productService.GetListCategoryHasPromotion(); return(View(promotion)); }
public IActionResult Index(int id) { ProductIndexViewModel product = new ProductIndexViewModel() { }; product.ProductCategory = _productCategoryService.GetById(id); product.Slides = _slideService.GetAll(true); product.Advertistments = _advertistmentService.GetbyPageAndPosition(PageName.Orther, PositionName.Default); product.Tags = _productService.GetAllTag(15); product.DomainApi = _config["DomainApi:Domain"]; return(View(product)); }
public JsonResult GetAll(string searchstr, int page, int pageSize = 5) { var model = _SlideService.GetAll(searchstr); var SlideList = Mapper.Map <IEnumerable <Slide>, IEnumerable <SlideViewModel> >(model); var data = SlideList. Skip((page - 1) * pageSize). Take(pageSize); int totalRow = SlideList.Count(); return(Json(new { data = data, total = totalRow, status = true }, JsonRequestBehavior.AllowGet)); }
public ActionResult <List <SlideDto> > GetAll() { var slides = _slideService.GetAll(); return(Ok(slides)); }