Esempio n. 1
0
        public async Task <ActionResult> Delete(Guid id)
        {
            var authorExists = await _authorManager.AuthorExistsAsync(id.ToString());

            if (!authorExists)
            {
                return(NotFound($"The author: {id} cannot found"));
            }

            try
            {
                await _authorManager.DeActivateAsync(id);

                if (_authorManager.ProcessResult.Success)
                {
                    return(NoContent());
                }

                throw new Exception($"Deleting author {id} failed on saving");
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }