public async Task <IActionResult> Edit(int id, [Bind("stt,Id_SP,Name_SP,Price_SP,sl,image_sp,Size,Loai_SP")] cart_clone cart_clone)
        {
            if (id != cart_clone.stt)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cart_clone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!cart_cloneExists(cart_clone.stt))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cart_clone));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(string id, [Bind("Id_SP,Id_SP_Option,Loai_SP,Size,SL_co,Ngay_ADD,Image_SP_Option")] ThongSo_SP thongSo_SP)
        {
            id = id.Replace("%252F", "/");
            // viết bằng ajax
            if (id != thongSo_SP.Image_SP_Option)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(thongSo_SP);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ThongSo_SPExists(thongSo_SP.Image_SP_Option))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(thongSo_SP));
        }
        public async Task <IActionResult> Edit(string id, [Bind("Id_SP,Loai_SP_1,Loai_SP_2,Name_SP,Price_SP,Mo_Ta")] San_Pham san_Pham)
        {
            if (id != san_Pham.Id_SP)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(san_Pham);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!San_PhamExists(san_Pham.Id_SP))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(san_Pham));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("stt,Id_SP,Id_SP_Option,Size,sl")] Size_SP size_SP)
        {
            if (id != size_SP.stt)
            {
                return(NotFound());
            }

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