public async Task <IActionResult> PutCustomer(int id, Customer customer) { if (id != customer.CustomerId) { return(BadRequest()); } _context.Entry(customer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutBike(int id, Bike bike) { if (id != bike.BikeId) { return(BadRequest()); } _context.Entry(bike).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BikeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <int> Add(Movie entity) { rentalContext.Movies.Add(entity); await rentalContext.SaveChangesAsync(); return(entity.Id); }
public async Task <IActionResult> Create([Bind("ID,TC,Ad,Soyad,Telefon,eMail,Adres")] Müsteri müsteri) { if (ModelState.IsValid) { _context.Add(müsteri); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(müsteri)); }
public async Task <IActionResult> Create([Bind("ID,Plaka,Marka,Model,Yıl,Renk,GünlükÜcret,Cins")] Arac arac) { if (ModelState.IsValid) { _context.Add(arac); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(arac)); }
public async Task <IActionResult> Create([Bind("ID,AlışGünü,GeriTeslimGünü,MüsteriID,AracID")] Kiralama kiralama) { if (ModelState.IsValid) { _context.Add(kiralama); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AracID"] = new SelectList(_context.Araclar, "ID", "ID", kiralama.AracID); ViewData["MüsteriID"] = new SelectList(_context.Müsteriler, "ID", "ID", kiralama.MüsteriID); return(View(kiralama)); }
public async Task <int> Add(Customer entity) { rentalContext.Customers.Add(entity); await rentalContext.SaveChangesAsync(); return(entity.Id); }
public async Task <IActionResult> PutRental(int id, Object rental) { CopyPropertiesTo(rental, _context.Rentals.Find(id)); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RentalExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }