public async Task <IActionResult> Edit(int id, [Bind("Id,Surname,Name,Patronymic,Mobile_Number,Email")] 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));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] TypeProduct typeProduct)
        {
            if (id != typeProduct.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typeProduct);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypeProductExists(typeProduct.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeProduct));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,IdProduct,IdOrder,IdProvider,IdEmployee,DateDelivery,DateDeparture")] Sending sending)
        {
            if (id != sending.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sending);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SendingExists(sending.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdEmployee"] = new SelectList(_context.Employees, "Id", "Id", sending.IdEmployee);
            ViewData["IdOrder"]    = new SelectList(_context.Order, "Id", "Id", sending.IdOrder);
            ViewData["IdProduct"]  = new SelectList(_context.Products, "Id", "Id", sending.IdProduct);
            ViewData["IdProvider"] = new SelectList(_context.Providers, "Id", "Id", sending.IdProvider);
            return(View(sending));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Adress,Mobile_Number,Email")] Provider provider)
        {
            if (id != provider.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(provider);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProviderExists(provider.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(provider));
        }
示例#5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,IdCountry")] Creator creator)
        {
            if (id != creator.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(creator);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CreatorExists(creator.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCountry"] = new SelectList(_context.Countries, "Id", "Id", creator.IdCountry);
            return(View(creator));
        }
示例#6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Salary,Responsibility")] Post post)
        {
            if (id != post.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(post);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PostExists(post.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(post));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Country country)
        {
            if (id != country.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryExists(country.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(country));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,IdClient,Data")] 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["IdClient"] = new SelectList(_context.Clients, "Id", "Id", order.IdClient);
            return(View(order));
        }
示例#9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,IdTypeProduct,IdCreator")] Product product)
        {
            if (id != product.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCreator"]     = new SelectList(_context.Creators, "Id", "Id", product.IdCreator);
            ViewData["IdTypeProduct"] = new SelectList(_context.TypeProducts, "Id", "Id", product.IdTypeProduct);
            return(View(product));
        }
示例#10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Surname,Name,Patronymic,Mobile_Number,IdPost")] Employee employee)
        {
            if (id != employee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdPost"] = new SelectList(_context.Posts, "Id", "Id", employee.IdPost);
            return(View(employee));
        }