Exemple #1
0
        public async Task <IActionResult> Post([FromBody] Dictionary <string, string> resources)
        {
            try
            {
                if (resources == null)
                {
                    return(BadRequest("resources are empty"));
                }

                resources = await _localizationService.CreateResourcesAsync(resources);

                if (resources.Count == 1 && resources.ContainsKey("error"))
                {
                    return(BadRequest(resources["error"]));
                }

                return(Ok(resources));
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to execute POST");
                return(StatusCode(500, ex.Message));
            }
        }