示例#1
0
        public async Task <IActionResult> PutTeacher(int id, Teacher teacher)
        {
            if (id != teacher.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PutInstitute(int id, Institute institute)
        {
            if (id != institute.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }