public IActionResult Edit(Tour tour) { if (ModelState.IsValid) { try { _db.Update(tour); _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ToursExists(tour.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["TourKindId"] = new SelectList(_db.TourKinds, "Id", "Name", tour.TourKindId); ViewData["ClientId"] = new SelectList(_db.Clients, "Id", "Name", tour.ClientId); return(View(tour)); }
public async Task <IActionResult> PutTour([FromBody] Tour tour) { if (tour == null) { return(BadRequest()); } if (!TourExists(tour.Id)) { return(NotFound()); } _context.Update(tour); _context.SaveChanges(); return(Ok(tour)); }
public IActionResult Edit(TourKind tourKind) { if (ModelState.IsValid) { try { _db.Update(tourKind); _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TourKindsExists(tourKind.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(tourKind)); }
public IActionResult Edit(Client client) { if (ModelState.IsValid) { try { _db.Update(client); _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ClientsExists(client.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(client)); }