Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ProductID,BrandID,CategoryID,ProductName,ThumbnailImage,Length,Height,Width,Weight,UnitofLength,UnitofWeight,UnitPrice,Currency,Description,CreatedTime,LastUpdateTime")] Product product)
        {
            if (id != product.ProductID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                } catch (DbUpdateConcurrencyException) {
                    if (!ProductExists(product.ProductID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("BrandID,BrandName,Logo,Description")] Brand brand)
        {
            if (id != brand.BrandID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(brand);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrandExists(brand.BrandID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(brand));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Update(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(category));
        }