Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("BodyTypeId,BodyTypeNames")] BodyType bodyType)
        {
            if (id != bodyType.BodyTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bodyType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BodyTypeExists(bodyType.BodyTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bodyType));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ServiceId,TypeOfService")] Service service)
        {
            if (id != service.ServiceId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(service);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ServiceExists(service.ServiceId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(service));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ColorId,ColorName")] Color color)
        {
            if (id != color.ColorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(color);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ColorExists(color.ColorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(color));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("ManagerId,FullName,Telephone")] Manager manager)
        {
            if (id != manager.ManagerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(manager);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ManagerExists(manager.ManagerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(manager));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CarId,ModelId,Price,GraduationYear,BodyTypeId,ColorId,DriveId")] 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(IndexAuto)));
            }
            ViewData["BodyTypeId"] = new SelectList(_context.BodyTypes, "BodyTypeId", "BodyTypeNames", car.BodyTypeId);
            ViewData["ColorId"]    = new SelectList(_context.Colors, "ColorId", "ColorName", car.ColorId);
            ViewData["DriveId"]    = new SelectList(_context.Drives, "DriveId", "DriveType", car.DriveId);
            ViewData["ModelId"]    = new SelectList(_context.Models, "ModelId", "ModelName", car.ModelId);
            return(View(car));
        }
Esempio n. 6
0
        public async Task <IActionResult> Edit(int id, [Bind("ModelId,ModelName")] Model model)
        {
            if (id != model.ModelId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(model);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ModelExists(model.ModelId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DriveId,DriveType")] Drife drife)
        {
            if (id != drife.DriveId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(drife);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DrifeExists(drife.DriveId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(drife));
        }
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,ManagerId,ModelId,CustomerId,OrderTypeId,OrderDate")] Order order)
        {
            if (id != order.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(IndexOrder)));
            }

            ViewData["ManagerId"]   = new SelectList(_context.Managers, "ManagerId", "FullName", order.ManagerId);
            ViewData["CustomerId"]  = new SelectList(_context.Customers, "CustomerId", "FullName", order.CustomerId);
            ViewData["ModelId"]     = new SelectList(_context.Models, "ModelId", "ModelName", order.ModelId);
            ViewData["OrderTypeId"] = new SelectList(_context.OrderTypes, "OrderTypeId", "OrderName", order.OrderTypeId);
            return(View(order));
        }