/// <inheritdoc /> public void Update(Guid id, ProductUpdate model) { ProductDb product = GetSingle(id); product.Description = model.Description; _dbContext.SaveChanges(); }
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); }
/// <inheritdoc /> public Product Get(Guid id) { ProductDb product = GetSingle(id); return(_mapper.Map <Product>(product)); }