Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("CarFaultID,name,severity,fixCost")] CarFault carFault)
        {
            if (ModelState.IsValid)
            {
                _context.Add(carFault);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(carFault));
        }
        public async Task <IActionResult> Create(CarMake carMake)
        {
            if (ModelState.IsValid)
            {
                _context.Add(carMake);
                await _context.SaveChangesAsync();

                return(RedirectToAction("../CarEdit/Index"));
            }
            return(View("../CarEdit/Index"));
        }
        public async Task <IActionResult> Create([Bind("CarVersionID,version,CarModelID")] CarVersion carVersion)
        {
            if (ModelState.IsValid)
            {
                _context.Add(carVersion);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CarModelID"] = new SelectList(_context.CarModels, "CarModelID", "model", carVersion.CarModelID);
            return(View(carVersion));
        }
        public async Task <IActionResult> Create([Bind("CarModelID,model,CarMakeID")] CarModel carModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(carModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction("../CarEdit/Index"));
            }
            ViewData["CarMakeID"] = new SelectList(_context.CarMakes, "CarMakeID", "make", carModel.CarMakeID);
            return(View("../CarEdit/Index"));
        }