Esempio n. 1
0
        public IActionResult AddPublicationCode(string publicationcode, int id)
        {
            var idUser = Int32.Parse(User.FindFirst("IdUsuario")?.Value);
            var user   = _authorService.FindUserById(idUser);

            if (user.OwnerId != id)
            {
                return(RedirectToAction("AccessDenied", "Users"));
            }
            var author = _authorService.FindAuthorById(id);

            _authorService.AddPublicationCode(author, publicationcode);
            return(RedirectToAction(nameof(GetNewCode), new { id = id }));
        }