Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 4
0
        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));
        }
Esempio n. 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));
        }
Esempio n. 6
0
        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));
        }
Esempio n. 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));
        }
Esempio n. 8
0
        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));
        }
Esempio n. 9
0
        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));
        }