Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Price,BrandsID")] Products products)
        {
            if (id != products.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(products);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductsExists(products.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrandsID"] = new SelectList(_context.Brands, "ID", "Name", products.Brands.Name);
            return(View(products));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Address")] Providers providers)
        {
            if (id != providers.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(providers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProvidersExists(providers.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(providers));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Address,OwnersID")] Shops shops)
        {
            if (id != shops.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shops);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShopsExists(shops.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OwnersID"] = new SelectList(_context.Owners, "ID", "Name", shops.Owners.Name);
            return(View(shops));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Info,ProvidersID")] Brands brands)
        {
            if (id != brands.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(brands);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrandsExists(brands.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProvidersID"] = new SelectList(_context.Providers, "ID", "Name", brands.Providers.Name);
            return(View(brands));
        }