public async Task <IActionResult> Create([Bind("Id,LastName,FirstName,SurName,BirthDay,Address")] Tourist tourist) { if (ModelState.IsValid) { _context.Add(tourist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tourist)); }
public async Task <IActionResult> Create([Bind("Id,LastName,FirstName,SurName,Email")] Manager manager) { if (ModelState.IsValid) { _context.Add(manager); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(manager)); }
public async Task <IActionResult> Create([Bind("Id,CountryName,InfoVisa")] Country country) { if (ModelState.IsValid) { _context.Add(country); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Create(int cityId, [Bind("Id,HotelName,Stars,RoomType,CityId")] Hotel hotel) { hotel.CityId = cityId; if (ModelState.IsValid) { _context.Add(hotel); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); return(RedirectToAction("Index", "Hotels", new { id = cityId, name = _context.Cities.Where(c => c.Id == cityId).FirstOrDefault().CityName })); } // ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "CountryName", city.CountryId); //return View(city); return(RedirectToAction("Index", "Hotels", new { id = cityId, name = _context.Cities.Where(c => c.Id == cityId).FirstOrDefault().CityName })); }
public async Task <IActionResult> Create(int hotelId, [Bind("Id,TourName,TourDuration,ManagerId,HotelId")] Tour tour) { tour.HotelId = hotelId; if (ModelState.IsValid) { _context.Add(tour); // tour.Manager = _context.Managers.Find(tour.ManagerId); // tour.Hotel = _context.Hotels.Find(tour.HotelId); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); return(RedirectToAction("Index", "Tours", new { id = hotelId, name = _context.Hotels.Where(c => c.Id == hotelId).FirstOrDefault().HotelName })); } // ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "CountryName", city.CountryId); //return View(city); return(RedirectToAction("Index", "Tours", new { id = hotelId, name = _context.Hotels.Where(c => c.Id == hotelId).FirstOrDefault().HotelName })); }
public async Task <IActionResult> Create(int tourId, [Bind("Id,TourId,TouristId,Price,BuyDate,StartDate")] Voucher voucher) { voucher.TourId = tourId; if (ModelState.IsValid) { _context.Add(voucher); // tour.Manager = _context.Managers.Find(tour.ManagerId); // tour.Hotel = _context.Hotels.Find(tour.HotelId); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); return(RedirectToAction("Index", "Vouchers", new { id = tourId, name = _context.Tours.Where(c => c.Id == tourId).FirstOrDefault().TourName })); } // ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "CountryName", city.CountryId); //return View(city); return(RedirectToAction("Index", "Vouchers", new { id = tourId, name = _context.Tours.Where(c => c.Id == tourId).FirstOrDefault().TourName })); }