Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,StartTime,EndTime,EmployeeId,CarId")] RentedCars rentedCars)
        {
            if (id != rentedCars.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rentedCars);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RentedCarsExists(rentedCars.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CarId"]      = new SelectList(_context.Cars, "carID", "Name", rentedCars.CarId);
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeID", "Name", rentedCars.EmployeeId);
            return(View(rentedCars));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeID,Email,Name,Surname,passportID")] Employee employee)
        {
            if (id != employee.EmployeeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmployeeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["passportID"] = new SelectList(_context.Passports, "passportID", "Level", employee.passportID);
            return(View(employee));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("passportID,No,RegistationDate,Level")] Passport passport)
        {
            if (id != passport.passportID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(passport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PassportExists(passport.passportID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(passport));
        }
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeID,Age,Address,City,Country")] EmployeeDetails employeeDetails)
        {
            if (id != employeeDetails.EmployeeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeDetailsExists(employeeDetails.EmployeeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeID"] = new SelectList(_context.Employees, "EmployeeID", "Name", employeeDetails.EmployeeID);
            return(View(employeeDetails));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("carID,Name,CarImage,Model,price,Year,Run,BrandID")] Car car)
        {
            if (id != car.carID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(car);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarExists(car.carID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrandID"] = new SelectList(_context.Brands, "BrandId", "Name", car.BrandID);
            return(View(car));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("BrandId,Name,Description")] Brand brand)
        {
            if (id != brand.BrandId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(brand);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrandExists(brand.BrandId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(brand));
        }