Exemplo n.º 1
0
        public IActionResult MaterialApprovalDecision(int materialId)
        {
            var materialToApprove = _materialsService.GetMaterialToApprove(materialId);

            if (materialToApprove == null)
            {
                return(RedirectToAction("ResourceNotFound", "Error", new { error = "materiał o podanym Id nie istnieje." }));
            }

            ConfigureMaterialBreadcrumbs(materialId);

            var vm = new MaterialToApproveViewModel
            {
                MaterialId      = materialToApprove.MaterialId,
                Name            = materialToApprove.Name,
                Description     = materialToApprove.Description,
                CreatorUsername = materialToApprove.Creator.Username,
                UploadDate      = materialToApprove.UploadDate,
                Files           = materialToApprove.Files.Select(f =>
                                                                 new FileViewModel
                {
                    FileId       = f.FileId,
                    FileName     = f.FileName,
                    RelativePath = f.RelativePath,
                    ContentType  = f.ContentType
                }
                                                                 ).ToList()
            };

            return(View(vm));
        }