Пример #1
0
        public IActionResult Post([FromBody] Recipe model)
        {
            try
            {
                _repository.AddEntity(model);
                if (_repository.SaveAll())
                {
                    return(Created($"/api/orders/{model.Id}", model));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to save a new order: {ex}");
            }

            return(BadRequest("Failed to save new recipe."));
        }