public void DeletePhoneAmount(int id, int amount) { var phone = GetPhone(id); phone.Amount -= amount; _context.SaveChanges(); }
public PhonesController(PhonesContext context) { db = context; if (!db.Phones.Any()) { db.Phones.Add(new Phones { Name = "Huawei p20 pro", Brend = "Huawei", Price = 1290.00m }); db.Phones.Add(new Phones { Name = "Iphone 7", Brend = "Apple inc.", Price = 990.00m }); db.Phones.Add(new Phones { Name = "Xiaomi Redmi 5", Brend = "Xiaomi", Price = 349.00m }); db.SaveChanges(); } }
public void Create(Order order) { _context.Orders.Add(order); _context.SaveChanges(); }
public void Create(Reservation reservation) { _context.Reservations.Add(reservation); _context.SaveChanges(); }
public void Add(T entity) { _context.Set <T>().Add(entity); _context.SaveChanges(); }