Ejemplo n.º 1
0
        public IActionResult ApproveMaterial(int materialId, bool isRedirectToMaterial)
        {
            var loggedUser = _userService.FindByIdentityUserId(User.FindFirstValue(ClaimTypes.NameIdentifier));

            var material = _materialsService.GetMaterial(materialId);

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

            _materialsService.ApproveMaterial(material, loggedUser);

            if (isRedirectToMaterial)
            {
                return(RedirectToAction("Material", "Materials", new { area = "Main", materialId }));
            }

            return(RedirectToAction("MaterialsToApprove"));
        }