コード例 #1
0
        public async Task <IActionResult> Get(int id)
        {
            var product = await _cashService.TryExecuteAsync <Product>(() => _productRepository.GetProduct(id), id);

            if (product != null)
            {
                return(Content($"Product: {product.Name}"));
            }
            return(Content("Product not found"));
        }
コード例 #2
0
        public async Task <IActionResult> Get(int id)
        {
            var post = await _cashService.TryExecuteAsync <Post>(() => _postRepository.GetPost(id), id);

            if (post != null)
            {
                return(Content($"Description: {post.Description}"));
            }
            return(Content("Post not found"));
        }