コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Address,Contact,Email")] Store store)
        {
            if (ModelState.IsValid)
            {
                _context.Add(store);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(store));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Staff_Name,Staff_Last_Name,Staff_Address,Staff_Contact")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staff);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Customer_Name,DOB,Customer_Address,Customer_Contact")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,Car_Name,Car_Make,Car_Date,Car_Price")] Car car)
        {
            if (ModelState.IsValid)
            {
                _context.Add(car);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(car));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("Id,CustomerId,StaffId,StoreId,CarId")] Buy buy)
        {
            if (ModelState.IsValid)
            {
                _context.Add(buy);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CarId"]      = new SelectList(_context.Car, "Id", "Id", buy.CarId);
            ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Id", buy.CustomerId);
            ViewData["StaffId"]    = new SelectList(_context.Staff, "Id", "Id", buy.StaffId);
            ViewData["StoreId"]    = new SelectList(_context.Store, "Id", "Id", buy.StoreId);
            return(View(buy));
        }