public IActionResult Create(TourKind tourKind) { if (ModelState.IsValid) { if (TourKindsExists(tourKind.Id)) { return(View(tourKind)); } _db.Add(tourKind); _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tourKind)); }
public IActionResult Create(Client client) { if (ModelState.IsValid) { if (ClientsExists(client.Id)) { return(View(client)); } _db.Add(client); _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(client)); }
public IActionResult Create(Tour tour) { if (ModelState.IsValid) { if (ToursExists(tour.Id)) { return(View(tour)); } _db.Add(tour); _db.SaveChanges(); 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)); }