Esempio n. 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,IdClient,IdOrder")] ClientOrders clientOrders)
        {
            if (id != clientOrders.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clientOrders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientOrdersExists(clientOrders.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdClient"] = new SelectList(_context.Clients, "Id", "Id", clientOrders.IdClient);
            ViewData["IdOrder"]  = new SelectList(_context.Orders, "Id", "Id", clientOrders.IdOrder);
            return(View(clientOrders));
        }
        public async Task <IActionResult> Edit(Guid id, Order order)
        {
            if (id != order.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdEmployee"]     = new SelectList(_context.Employees, "Id", "Id", order.EmployeeId);
            ViewData["IdOrganization"] = new SelectList(_context.Organizations, "Id", "Id", order.OrganizationId);
            return(View(order));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Surname,Name,Patronymic,Address,PersonalNumber,PhoneNumber,TypeClient,Unn,BothDate,Information")] Client client)
        {
            if (id != client.Id)
            {
                return(NotFound());
            }

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