Esempio n. 1
0
        public async Task <IActionResult> DeleteLanguage(string code)
        {
            if (string.IsNullOrEmpty(code))
            {
                return(BadRequest(ErrorResponse.Create($"{nameof(code)} can't be empty")));
            }

            if (!code.IsValidPartitionOrRowKey())
            {
                return(BadRequest(ErrorResponse.Create($"Invalid {nameof(code)} value")));
            }

            var language = _service.Get(code);

            if (language == null)
            {
                return(BadRequest(ErrorResponse.Create($"Language with code '{code}' not found")));
            }

            await _service.DeleteAsync(code);

            return(Ok());
        }