예제 #1
0
        public async Task <IActionResult> PutChuongTrinh(int id, ChuongTrinh chuongTrinh)
        {
            if (id != chuongTrinh.MaChuongTrinh)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> PutSinhVien(string id, SinhVien sinhVien)
        {
            if (id != sinhVien.Mssv)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }