public async Task <IActionResult> Edit(int id, [Bind("IdOrder,IdClient,IdEmployee,DetailsAmount,OrderCost,Discount,AmountOrdersOnDate,Chek")] Orders orders)
        {
            if (id != orders.IdOrder)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.IdOrder))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdClient"]   = new SelectList(_context.Clients, "IdClient", "IdClient", orders.IdClient);
            ViewData["IdEmployee"] = new SelectList(_context.Employees, "IdEmployee", "IdEmployee", orders.IdEmployee);
            return(View(orders));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdDetail,IdMaterial,Weight,Colour,Diameter,Cost,IdOrder,AmountDetails")] Details details)
        {
            if (id != details.IdDetail)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(details);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DetailsExists(details.IdDetail))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdMaterial"] = new SelectList(_context.MaterialTypes, "IdMaterial", "IdMaterial", details.IdMaterial);
            ViewData["IdOrder"]    = new SelectList(_context.Orders, "IdOrder", "IdOrder", details.IdOrder);
            return(View(details));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdMaterial,TypeMaterial")] MaterialTypes materialTypes)
        {
            if (id != materialTypes.IdMaterial)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(materialTypes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterialTypesExists(materialTypes.IdMaterial))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(materialTypes));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdSupplier,Name,Adress,TelephonNumber")] Suppliers suppliers)
        {
            if (id != suppliers.IdSupplier)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(suppliers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SuppliersExists(suppliers.IdSupplier))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(suppliers));
        }
Example #5
0
        public async Task <IActionResult> Edit(int id, [Bind("IdEmployee,Name,Adress,FirmName")] Employees employees)
        {
            if (id != employees.IdEmployee)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employees);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeesExists(employees.IdEmployee))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employees));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdInvoice,IdSupplier,IdEmployee,IdMaterial,DeliveryDate,Cost,Weight")] Invoices invoices)
        {
            if (id != invoices.IdInvoice)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(invoices);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InvoicesExists(invoices.IdInvoice))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdEmployee"] = new SelectList(_context.Employees, "IdEmployee", "IdEmployee", invoices.IdEmployee);
            ViewData["IdMaterial"] = new SelectList(_context.MaterialTypes, "IdMaterial", "IdMaterial", invoices.IdMaterial);
            ViewData["IdSupplier"] = new SelectList(_context.Suppliers, "IdSupplier", "IdSupplier", invoices.IdSupplier);
            return(View(invoices));
        }
Example #7
0
        public async Task <IActionResult> Edit(int id, [Bind("IdClient,Discount,Telephone,Adress,FirmName,Representative")] Clients clients)
        {
            if (id != clients.IdClient)
            {
                return(NotFound());
            }

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