public async Task <IActionResult> Edit(int id, [Bind("Id,WaybillId,OrderDetailsId,Weighting")] WaybillDetails waybillDetails)
        {
            if (id != waybillDetails.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(waybillDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WaybillDetailsExists(waybillDetails.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderDetailsId"] = new SelectList(_context.OrderDetails, "Id", "ProductName", waybillDetails.OrderDetailsId);
            ViewData["WaybillId"]      = new SelectList(_context.Waybill, "Id", "Id", waybillDetails.WaybillId);
            return(View(waybillDetails));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Color")] WaybillStatuses waybillStatuses)
        {
            if (id != waybillStatuses.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(waybillStatuses);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WaybillStatusesExists(waybillStatuses.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(waybillStatuses));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ShopId,OrderStatusId,CustomerId,UserId,OrderOutId,ShipAddressId,InvoiceAddressId,ShipStatusId,TotalPrice,Deposit,OrderDatetime,Created,Modified,Comment,LastCheck,OrderOutRef,Payment,Shipment,ShipUndertakenDate,ShipExpectedDate,ShipDeliveredDate")] Orders orders)
        {
            if (id != orders.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"]       = new SelectList(_context.Customers, "Id", "Email", orders.CustomerId);
            ViewData["InvoiceAddressId"] = new SelectList(_context.InvoiceAddresses, "Id", "Address", orders.InvoiceAddressId);
            ViewData["OrderStatusId"]    = new SelectList(_context.OrderStatuses, "Id", "Name", orders.OrderStatusId);
            ViewData["ShipAddressId"]    = new SelectList(_context.ShipAddresses, "Id", "Address", orders.ShipAddressId);
            ViewData["ShipStatusId"]     = new SelectList(_context.ShipStatuses, "Id", "Name", orders.ShipStatusId);
            ViewData["ShopId"]           = new SelectList(_context.Shops, "Id", "BaseUrl", orders.ShopId);
            ViewData["UserId"]           = new SelectList(_context.AspNetUsers, "Id", "Id", orders.UserId);
            return(View(orders));
        }