예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Associatesid,Experiance,Age,Name,PostId")] Associates associates)
        {
            if (id != associates.Associatesid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(associates);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AssociatesExists(associates.Associatesid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PostId"] = new SelectList(_context.Post, "Postid", "Postid", associates.PostId);
            return(View(associates));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Carsid,RegistrationNumber,MarkId,BodyNumber,Data,EngineNumber,Year,Mileage,DateOfLastMaintetance,Machanic,SpecialMarks,DriverId")] Cars cars)
        {
            if (id != cars.Carsid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cars);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarsExists(cars.Carsid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DriverId"] = new SelectList(_context.Associates, "Associatesid", "Associatesid", cars.DriverId);
            ViewData["MarkId"]   = new SelectList(_context.CarsMark, "CarsMarkid", "CarsMarkid", cars.MarkId);
            return(View(cars));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Callsid,DateAndTime,PhoneNumber,DstinationNumber,CarId")] Calls calls)
        {
            if (id != calls.Callsid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(calls);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CallsExists(calls.Callsid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CarId"] = new SelectList(_context.Cars, "Carsid", "Carsid", calls.CarId);
            return(View(calls));
        }