Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, [Bind("Egn,Name,Adress,Tel")] Clients clients)
        {
            if (id != clients.Egn)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clients);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientsExists(clients.Egn))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clients));
        }
        public async Task <IActionResult> Edit(string id, [Bind("Clients,Distributors,Number,Naimenovanie,Quantity,Price,Data")] Products products)
        {
            if (id != products.Clients)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(products);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductsExists(products.Clients))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Clients"]      = new SelectList(_context.Clients, "Egn", "Egn", products.Clients);
            ViewData["Distributors"] = new SelectList(_context.Distributors, "DistrId", "Name", products.Distributors);
            return(View(products));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DistrId,Name,TelContact")] Distributors distributors)
        {
            if (id != distributors.DistrId)
            {
                return(NotFound());
            }

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