示例#1
0
        //http://localhost:5000/api/Banner/Get?BannerId=Product
        public Task <string> Get(BannerRequest req)
        {
            var temp      = $"/Controllers/Banners/Templates/{req.BannerId}.cshtml";
            var viewModel = _bannerProviderFactory.Create(req.BannerId)
                            .Build(req);

            return(_viewRenderer.RenderViewToStringAsync(temp, viewModel));
        }
示例#2
0
        public async Task <string> GetBanner(GetBannersDataReq req)
        {
            var bannerData = _pizzaRepo.GetBannersData(req)
                             .FirstOrDefault();

            if (bannerData == null)
            {
                return(String.Empty);
            }

            return(await _viewToStringRenderer.RenderViewToStringAsync <object>(
                       @$ "/banner-template:/{bannerData.Uid}.banner-template",
                       bannerData));
        }