public async Task <IActionResult> Edit(string id, [Bind("city_name,State,city_pincode,branch_address")] City city)
        {
            if (id != city.city_name)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(city);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CityExists(city.city_name))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(city));
        }
        public async Task <IActionResult> Edit(int id, [Bind("emp_id,emp_name,emp_role,emp_address,emp_city,emp_email,emp_password")] Employee employee)
        {
            if (id != employee.emp_id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.emp_id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(long id, [Bind("ID,user,package_type,date,destination_city,Consignee_name,address,pkg_weight_in_grams,amount")] Consignment_Details consignment_Details)
        {
            if (id != consignment_Details.ID)
            {
                return(NotFound());
            }

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