public ActionResult GetStatByChart(int TagId) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <TagDTO, TagVM>() .ForMember(t => t.Ads, p => p.Ignore()); cfg.CreateMap <InfoReviewTagDTO, InfoReviewTagVM>(); }); var mapper = config.CreateMapper(); var tag = mapper.Map <TagDTO, TagVM>(tagService.GetTag(TagId)); List <InfoReviewTagVM> ReviewTag = new List <InfoReviewTagVM>(); ReviewTag = tag.InfoReviewTags.ToList(); GetStatistics stat = new GetStatistics(ReviewTag); stat.ListStat(); List <StatisticsForChart> statForChart = stat.ListStatForChart(); if (statForChart != null) { return(PartialView(statForChart)); } else { return(new EmptyResult()); } }
public JsonResult GetStatByChartAjax(int TagId) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <TagDTO, TagVM>() .ForMember(t => t.Ads, p => p.Ignore()); cfg.CreateMap <InfoReviewTagDTO, InfoReviewTagVM>(); }); var mapper = config.CreateMapper(); var tag = mapper.Map <TagDTO, TagVM>(tagService.GetTag(TagId)); List <InfoReviewTagVM> ReviewTag = new List <InfoReviewTagVM>(); ReviewTag = tag.InfoReviewTags.ToList(); GetStatistics stat = new GetStatistics(ReviewTag); stat.ListStat(); List <StatisticsForChart> statForChart = stat.ListStatForChart(); return(Json(statForChart, JsonRequestBehavior.AllowGet)); }