Beispiel #1
0
        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));
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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));
        }