Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,SupplierName,Email,Phone")] Supplier supplier)
        {
            if (ModelState.IsValid)
            {
                _context.Add(supplier);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(supplier));
        }
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Address,Email,Phone")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,CarBrandName,CarModel,CarYear,Fuel,Transmission,Color,InStock,SupplierFK")] Car car)
        {
            if (ModelState.IsValid)
            {
                _context.Add(car);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SupplierFK"] = new SelectList(_context.Supplier, "Id", "SupplierName", car.SupplierFK);
            return(View(car));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,DateOfPurchase,WarrantyDuration,CarFK,CustomerFK")] Store store)
        {
            if (ModelState.IsValid)
            {
                _context.Add(store);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CarFK"]      = new SelectList(_context.Car, "Id", "CarBrandName", store.CarFK);
            ViewData["CustomerFK"] = new SelectList(_context.Customer, "Id", "FullName", store.CustomerFK);
            return(View(store));
        }