コード例 #1
0
        public async Task <IActionResult> PutLoaiSp(int id, LoaiSp loaiSp)
        {
            var lsp = new LoaiSp();

            var result = _context.LoaiSps.Where(th => th.Id == id).FirstOrDefault <LoaiSp>();

            if (result != null && lsp != null)
            {
                result.TenLoaiSp = loaiSp.TenLoaiSp;
                result.MoTa      = loaiSp.MoTa;
                _context.SaveChanges();
            }
            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> PutThuongHieu(int id, ThuongHieu thuongHieu)
        {
            var thuongHieux = new ThuongHieu();

            var result = _context.ThuongHieux.Where(th => th.Id == id).FirstOrDefault <ThuongHieu>();

            if (result != null && thuongHieu != null)
            {
                result.TenThuongHieu = thuongHieu.TenThuongHieu;
                result.MoTa          = thuongHieu.MoTa;
                _context.SaveChanges();
            }
            return(Ok());
        }
コード例 #3
0
        public async Task <IActionResult> PutKichCoSp(int id, KichCoSp kichCoSp)
        {
            var lsp = new LoaiSp();

            var result = _context.KichCoSps.Where(th => th.Id == id).FirstOrDefault <KichCoSp>();

            if (result != null && lsp != null)
            {
                result.TenKichCo = kichCoSp.TenKichCo;
                result.GiaSp     = kichCoSp.GiaSp;
                result.IdSanPham = kichCoSp.IdSanPham;
                _context.SaveChanges();
            }
            return(Ok());
        }
コード例 #4
0
        public async Task <IActionResult> PutSanPham(int id, SanPham sanPham)
        {
            var sp = new SanPham();

            var result = _context.SanPhams.Where(th => th.Id == id).FirstOrDefault <SanPham>();

            if (result != null && sp != null)
            {
                result.TenSp    = sanPham.TenSp;
                result.MoTa     = sanPham.MoTa;
                result.LoiIch   = sanPham.LoiIch;
                result.IdLoaiSp = sanPham.IdLoaiSp;
                _context.SaveChanges();
            }
            return(Ok());
        }