Esempio n. 1
0
        public async Task <IActionResult> Execute()
        {
            var categories = await _repository.GetAll();

            _halResponseBuilder.AddLinks(l => l.AddSelf("/" + Constants.RouteNames.ShopCategories));
            foreach (var category in categories)
            {
                _shopCategoryEnricher.Enrich(_halResponseBuilder, category);
            }

            return(new OkObjectResult(_halResponseBuilder.Build()));
        }
Esempio n. 2
0
        public async Task <IActionResult> Execute(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentNullException(nameof(id));
            }


            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentNullException(nameof(id));
            }

            var category = await _repository.Get(id);

            if (category == null)
            {
                return(new NotFoundResult());
            }

            _shopCategoryEnricher.Enrich(_halResponseBuilder, category);
            return(new OkObjectResult(_halResponseBuilder.Build()));
        }