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

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

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

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

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

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

            return(NoContent());
        }
示例#3
0
        public async Task <ActionResult <Student> > Post([FromBody] Student student)
        {
            _context.Students.Add(student);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Get", new { id = student.Id }, student));
        }