Exemple #1
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));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id_SP,Id_SP_Option,Loai_SP,Size,SL_co,Ngay_ADD,Image_SP_Option")] ThongSo_SP thongSo_SP)
        {
            if (ModelState.IsValid)
            {
                _context.Add(thongSo_SP);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Create", "Size_SP", new { id = thongSo_SP.Id_SP, id1 = thongSo_SP.Id_SP_Option }));
            }
            return(View(thongSo_SP));
        }
Exemple #3
0
        // GET: ThongSo_SP/Create
        public IActionResult Create(string id)
        {
            ThongSo_SP thongSo_SP = new ThongSo_SP();

            if (id == null)
            {
                return(NotFound());
            }
            else
            {
                thongSo_SP.Id_SP = id;
            }
            return(View(thongSo_SP));
        }