コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Desc,ExtraBeds,View,IsBalcony,BasicPrice,ImgUrl")] RoomType roomType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roomType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(roomType));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Tz,Name,PhoneNumber,Address,Email")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,WorkerId,Name,PhoneNumber,Email,WorkerType")] Worker worker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(worker);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Login)));
            }
            return(View(worker));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,FromDate,ToDate,NumOfAdults,NumOfKids,NumOfInfants,TotalPrice")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();


                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("RoomId,OrderId")] RoomsOrders roomsOrders)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roomsOrders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderId"] = new SelectList(_context.Order, "Id", "ClientID", roomsOrders.OrderId);
            ViewData["RoomId"]  = new SelectList(_context.Room, "Id", "Id", roomsOrders.RoomId);
            return(View(roomsOrders));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("Id,Type,IsTwinBed,Floor,IsAvailable")] Room room)
        {
            if (HttpContext.Session.GetString("Name") == null)
            {
                return(RedirectToAction("Login", "Workers"));
            }
            if (ModelState.IsValid)
            {
                _context.Add(room);
                await _context.SaveChangesAsync();

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