示例#1
0
        public async Task <IActionResult> PutMajor(int id, Major major)
        {
            if (id != major.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PutEnrolled(int id, Enrolled enrolled)
        {
            if (id != enrolled.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }