Exemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, [Bind("idAccount,username,passwd,avt_path,rate,rankVip,IdMerchant,idCustomer")] Account account)
        {
            if (id != account.idAccount)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(account);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountExists(account.idAccount))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["idCustomer"] = new SelectList(_context.Customers, "idCustomer", "idCustomer", account.idCustomer);
            ViewData["IdMerchant"] = new SelectList(_context.Merchants, "idMerchant", "idMerchant", account.IdMerchant);
            return(View(account));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("idPosition,width,height")] Position position)
        {
            if (id != position.idPosition)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(position);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PositionExists(position.idPosition))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(position));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(string id, [Bind("idProduct,nameProduct,Code,Description,Image,Size,Sex,OldPrice,Price,Creat_date,Count,Fee,Home,Status,View,Color,idCategory,idAccount,IdRepository,IdBrand")] Product product)
        {
            if (id != product.idProduct)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.idProduct))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["idAccount"]    = new SelectList(_context.Accounts, "idAccount", "idAccount", product.idAccount);
            ViewData["IdBrand"]      = new SelectList(_context.Brands, "IdBrand", "IdBrand", product.IdBrand);
            ViewData["idCategory"]   = new SelectList(_context.Categories, "idCategory", "idCategory", product.idCategory);
            ViewData["IdRepository"] = new SelectList(_context.Repositories, "idRepository", "idRepository", product.IdRepository);
            return(View(product));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(string id, [Bind("id,id_Acc,id_Mer,createdDate,Checked,stt")] RegisterNotify registerNotify)
        {
            if (id != registerNotify.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(registerNotify);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegisterNotifyExists(registerNotify.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(registerNotify));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("IdBrand,NameBrand")] Brand brand)
        {
            if (id != brand.IdBrand)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(brand);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrandExists(brand.IdBrand))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(brand));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(string id, [Bind("idCategory,nameCategory,link_imageCategory,Sex")] Category category)
        {
            if (id != category.idCategory)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.idCategory))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Edit(string id, [Bind("idMerchant,lstname,fstname,storename,phone,website,stt")] Model.Users.Merchant merchant)
        {
            if (id != merchant.idMerchant)
            {
                return(NotFound());
            }

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