/// <inheritdoc /> public async Task <Product> UpdateProduct(int id, ProductSlim product) { Product toUpdate = await GetProduct(id); if (toUpdate == default) { return(null); } toUpdate.Name = product.Name ?? toUpdate.Name; toUpdate.Price = product.Price ?? toUpdate.Price; EntityEntry <Product> updatedProduct = _context.Update(toUpdate); await _context.SaveChangesAsync(); return(updatedProduct.Entity); }