示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,VehicleModel")] MarkaNaVozilo markaNaVozilo)
        {
            if (id != markaNaVozilo.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(markaNaVozilo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MarkaNaVoziloExists(markaNaVozilo.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(markaNaVozilo));
        }
        //Makes changes to the selected record
        public async Task <IActionResult> Edit(int id, [Bind("Id,LicensePlateNumber,Vin,VehicleModel")] DataForVehicles dataForVehicles)
        {
            if (id != dataForVehicles.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dataForVehicles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DataForVehiclesExists(dataForVehicles.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VehicleModel"] = new SelectList(_context.MarkaNaVozilo, "VehicleModel", "VehicleModel", dataForVehicles.VehicleModel);
            return(View(dataForVehicles));
        }