Ejemplo n.º 1
0
        public async Task <ActionResult <LkStudent> > PostLkStudent(LkStudent lkStudent)
        {
            _context.Students.Add(lkStudent);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLkStudent", new { id = lkStudent.Id }, lkStudent));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutLkStudent(int id, LkStudent lkStudent)
        {
            if (id != lkStudent.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 3
0
 public Task UpdateStudent(LkStudent stud)
 {
     _db.Students.Update(stud);
     return(_db.SaveChangesAsync());
 }