public void Update(Manufacturer manufacturer) { using (var dbContext = new SportStoreDbContext()) { var manufacturerInRepository = dbContext.ManufacturerDbSet.Find(manufacturer.Id); dbContext.Entry(manufacturerInRepository).CurrentValues.SetValues(manufacturer); dbContext.SaveChanges(); } }
public void Update(PaymentMethod payment) { using (var dbContext = new SportStoreDbContext()) { var paymentMethodInRepository = dbContext.PaymentMethodDbSet.Find(payment.Id); dbContext.Entry(paymentMethodInRepository).CurrentValues.SetValues(payment); dbContext.SaveChanges(); } }
public void Update(ShippingAddress shippingAddress) { using (var dbContext = new SportStoreDbContext()) { var shippingAddressInRepository = dbContext.ShippingAddressDbSet.Find(shippingAddress.Id); dbContext.Entry(shippingAddressInRepository).CurrentValues.SetValues(shippingAddress); dbContext.SaveChanges(); } }
public void Update(PurchasedProduct purchasedProduct) { using (var dbContext = new SportStoreDbContext()) { var purchasedProductInRepository = GetById(purchasedProduct.Id); dbContext.Entry(purchasedProductInRepository).CurrentValues.SetValues(purchasedProduct); dbContext.SaveChanges(); } }