Пример #1
0
        public async Task <IActionResult> Remove(int kadraId)
        {
            try
            {
                if (User.IsInRole("Admin"))
                {
                    await _kvService.DeleteKadra(kadraId);

                    return(StatusCode(StatusCodes.Status200OK));
                }
                else
                {
                    _logger.LogError("Current user is not an admin");
                    return(StatusCode(StatusCodes.Status403Forbidden));
                }
            }
            catch (InvalidOperationException e)
            {
                _logger.LogError(e.Message);
                return(StatusCode(StatusCodes.Status404NotFound));
            }
        }
Пример #2
0
        public async Task <IActionResult> Remove(int kadraId)
        {
            await _kvService.DeleteKadra(kadraId);

            return(StatusCode(StatusCodes.Status200OK));
        }