示例#1
0
        async Task <Customer> ICustomerRepository.UpdateAsync(Customer customer)
        {
            var current = await _db.Customer.FirstOrDefaultAsync(_customer => _customer.Id == customer.Id);

            if (current != null)
            {
                _db.Entry(current).CurrentValues.SetValues(customer);
            }

            await _db.SaveChangesAsync();

            return(customer);
        }
示例#2
0
        async Task <Order> IOrderRepository.UpdateAsync(Order order)
        {
            var current = await _db.Order.FirstOrDefaultAsync(_order => _order.Id == order.Id);

            if (current != null)
            {
                _db.Entry(current).CurrentValues.SetValues(order);
            }

            await _db.SaveChangesAsync();

            return(order);
        }
示例#3
0
        async public Task <Product> UpdateAsync(Product product)
        {
            var current = await _db.Product.FirstOrDefaultAsync(_product => _product.Id == product.Id);

            if (current != null)
            {
                _db.Entry(current).CurrentValues.SetValues(product);
            }

            await _db.SaveChangesAsync();

            return(product);
        }