public async Task <IActionResult> PutTaiKhoan(int id, TaiKhoan taiKhoan)
        {
            if (id != taiKhoan.Id)
            {
                return(BadRequest());
            }

            _context.Entry(taiKhoan).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TaiKhoanExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutHinhAnh(int id, HinhAnh hinhAnh)
        {
            if (id != hinhAnh.Id)
            {
                return(BadRequest());
            }

            _context.Entry(hinhAnh).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HinhAnhExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <SanPham> > PostSanPham(SanPham sanPham)
        {
            _context.SanPhams.Add(sanPham);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSanPham", new { id = sanPham.Id }, sanPham));
        }
        public async Task <ActionResult <ThuongHieu> > PostThuongHieu(ThuongHieu thuongHieu)
        {
            _context.ThuongHieux.Add(thuongHieu);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetThuongHieu", new { id = thuongHieu.Id }, thuongHieu));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult <KichCoSp> > PostKichCoSp(KichCoSp kichCoSp)
        {
            _context.KichCoSps.Add(kichCoSp);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetKichCoSp", new { id = kichCoSp.Id }, kichCoSp));
        }
Ejemplo n.º 6
0
        public async Task <ActionResult <LoaiSp> > PostLoaiSp(int idTH, LoaiSp loaiSp)
        {
            loaiSp.IdThuongHieu = idTH;
            _context.LoaiSps.Add(loaiSp);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLoaiSp", new { id = loaiSp.Id }, loaiSp));
        }