Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeName,EmployeeNo,Email,Password,ProjectName,Gender,CabId")] Employee employee)
        {
            if (id != employee.EmpId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmpId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CabId"] = new SelectList(_context.Cab, "CabId", "JourneyPlace", employee.CabId);
            return(View(employee));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("DropPointName,NewDropPointName,RouteId")] DropPoint dropPoint)
        {
            if (id != dropPoint.DropPointId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dropPoint);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DropPointExists(dropPoint.DropPointId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RouteId"] = new SelectList(_context.Route, "RouteId", "RouteName", dropPoint.RouteId);
            return(View(dropPoint));
        }