예제 #1
0
        public IActionResult DeleteKey([FromQuery] KeyDto key)
        {
            try
            {
                var res = _keysService.DeleteKey(key);

                if (res == false)
                {
                    var errMessage = new { success = res, message = "Error deleting key / could not find key" };

                    return(NotFound(errMessage));
                }

                var message = new { success = res, message = $"Successfully deleted {key.KeyName}" };

                return(Ok(message));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }