コード例 #1
0
        /// <inheritdoc />
        public void Update(Guid id, ProductUpdate model)
        {
            ProductDb product = GetSingle(id);

            product.Description = model.Description;

            _dbContext.SaveChanges();
        }
コード例 #2
0
        private ProductDb GetSingle(Guid id)
        {
            ProductDb product = _dbContext.Products.FirstOrDefault(x => x.Id == id);

            if (product is null)
            {
                throw new NotFoundException("Product has not been found.");
            }

            return(product);
        }
コード例 #3
0
        /// <inheritdoc />
        public Product Get(Guid id)
        {
            ProductDb product = GetSingle(id);

            return(_mapper.Map <Product>(product));
        }