public async Task <JsonResult> GetPortfolioFile(int id) { var portfolio = await _repository.Get(id); if (portfolio == null) { return(new JsonResult(null)); } return(new JsonResult(_fileUploader.GetFileSource(_env.WebRootPath, portfolio.FilePathGuid.ToString()))); }
public async Task <IActionResult> Index() { var homeVm = new HomeVm() { Contact = new Contact(), Favors = await _favorRepository.GetAll(), Portfolios = await _portfolioRepository.GetAll(), Resumes = await _resumeRepository.GetAll(), Setting = await _settingRepository.Get(1), Skills = await _skillRepository.GetAll(), SocialMedias = await _socialMediaRepository.GetAll() }; //Get portfolios images foreach (var portfolio in homeVm.Portfolios) { portfolio.FilePath = _fileUploader.GetFileSource(_env.WebRootPath, portfolio.FilePathGuid.ToString()); } //Get Cv file homeVm.Setting.CvFilePath = _fileUploader.GetFileSource(_env.WebRootPath, homeVm.Setting.CvFilePathGuid.ToString()); return(View(homeVm)); }