Ejemplo n.º 1
0
        public async Task <IActionResult> Details(Guid id)
        {
            var tempfileInfo = _fileData.Get(id);

            var model = new DetailsViewModel
            {
                fileInfo = tempfileInfo,
                photoUrl = await _blobService.GetTemporaryUrl(tempfileInfo.ContainerName, tempfileInfo.FileName)
            };

            if (model == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var companyId = GetNonAdminUserCompanyId();

            if (!companyId.IsNullOrWhiteSpace() && !model.fileInfo.ContainerName.Equals(companyId, StringComparison.OrdinalIgnoreCase))
            {
                return(RedirectToAction(nameof(AccountController.AccessDenied), nameof(AccountController).GetControllerName(),
                                        new { returnUrl = Request.Path }));
            }

            return(View(model));
        }
Ejemplo n.º 2
0
        public IActionResult Details(Guid id)
        {
            var model = _fileData.Get(id);

            if (model == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var companyId = GetNonAdminUserCompanyId();

            if (!companyId.IsNullOrWhiteSpace() && !model.ContainerName.Equals(companyId, StringComparison.OrdinalIgnoreCase))
            {
                return(RedirectToAction(nameof(AccountController.AccessDenied), nameof(AccountController).GetControllerName(),
                                        new { returnUrl = Request.Path }));
            }

            return(View(model));
        }