Exemple #1
0
        public async Task <IActionResult> Edit(HotelMVC hotel)
        {
            if (ModelState.IsValid)
            {
                _db.Update(hotel);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hotel));
        }
Exemple #2
0
        public async Task <IActionResult> Create(HotelMVC hotel)
        {
            if (ModelState.IsValid)
            {
                //if valid
                _db.HotelMvcs.Add(hotel);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hotel));
        }