Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Test test)
        {
            if (ModelState.IsValid)
            {
                _context.Add(test);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(test));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("IdRoom,RoomNumber,CheckIn,CheckOut,Description")] Room room)
        {
            if (ModelState.IsValid)
            {
                _context.Add(room);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("IdRole,NameRole")] Role role)
        {
            if (ModelState.IsValid)
            {
                _context.Add(role);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(role));
        }
        public async Task <IActionResult> Create([Bind("IdCountry,Name,Details")] Country country)
        {
            if (ModelState.IsValid)
            {
                _context.Add(country);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(country));
        }
Beispiel #5
0
        public async Task <IActionResult> Create([Bind("IdWheather,Details")] Weather weather)
        {
            if (ModelState.IsValid)
            {
                _context.Add(weather);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(weather));
        }
        public async Task <IActionResult> Create([Bind("IdHotel,Name,Stars,Description")] Hotel hotel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hotel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hotel));
        }
Beispiel #7
0
        public async Task <IActionResult> Create([Bind("IdUser,Username,Password,ConfirmPassword")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Create([Bind("IdCovid,ProcentageVaccination")] Covid covid)
        {
            if (ModelState.IsValid)
            {
                _context.Add(covid);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCovid"] = new SelectList(_context.Country, "IdCountry", "Name", covid.IdCovid);
            return(View(covid));
        }
        public async Task <IActionResult> Create([Bind("IdCity,Name")] City city)
        {
            if (ModelState.IsValid)
            {
                _context.Add(city);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCity"] = new SelectList(_context.Weather, "IdWheather", "Details", city.IdCity);
            return(View(city));
        }