コード例 #1
0
        public ItemController(IItemRepository repository)
        {
            _repository = repository;

            var flourItem = new Item
            {
                Name     = "Flour",
                Quantity = new Quantity()
                {
                    Unit = "L", Total = 1
                }
            };

            _repository.Add(flourItem);
            var eggItem = new Item
            {
                Name     = "Egg",
                Quantity = new Quantity()
                {
                    Unit = "P", Total = 8
                }
            };

            _repository.Add(eggItem);

            _fridgeService = new FridgeService(_repository);
        }
コード例 #2
0
 public Quantity Remove([FromBody] Item item)
 {
     return(_fridgeService.RemoveItem(item));
 }
コード例 #3
0
 public Quantity Create([FromBody] Item item)
 {
     return(_fridgeService.AddItem(item));
 }