コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Adress,Elevator,NumberOfRooms,Balcony,SquareMeter,Floor,Rent,RegisterTime")] Apartment apartment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(apartment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(apartment));
        }
コード例 #2
0
        public async Task <IActionResult> CreateConfirmed([Bind("Id,Name,LastName,PhoneNumber,email,Salary,socSecNum,ApartmentForeginKey")] Apply apply)
        {
            if (ModelState.IsValid)
            {
                _context.Add(apply);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApartmentForeginKey"] = new SelectList(_context.Apartment, "Id", "Adress", apply.ApartmentForeginKey);
            return(View(apply));
        }