예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,ParentChain,Rating,NumberOfRooms,Address,PhoneNumber,Email")] Hotel hotel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hotel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hotel));
        }
        public async Task <IActionResult> Create([Bind("Id,Price,Amenities,Capacity,View,Extendible,Damages")] Room room)
        {
            if (ModelState.IsValid)
            {
                _context.Database.EnsureCreated();
                _context.Add(room);
                await _context.SaveChangesAsync();

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