public IActionResult Delete(int id)
        {
            if (!_store.Delete(id))
            {
                return(NotFound());
            }

            return(NoContent());
        }
Exemple #2
0
        public ProviderStateMiddleware(RequestDelegate next, OrderStore store)
        {
            _next           = next;
            _providerStates = new Dictionary <string, Action>
            {
                {
                    "There are 2 orders in the store",
                    () =>
                    {
                        foreach (var order in store.GetAll())
                        {
                            store.Delete(order.Id);
                        }

                        store.Add(new Order {
                            Person = "person1", Item = "item1", Delivered = true
                        });
                        store.Add(new Order {
                            Person = "person2", Item = "item2", Delivered = false
                        });
                    }
                }
            };
        }