Exemplo n.º 1
0
        public async Task <IActionResult> PutDangkihoc(Dangkihoc dangkihoc)
        {
            //if (id != dangkihoc.Mahv)
            //{
            //    return BadRequest();
            //}

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Dangkihoc> > PostDangkihoc([FromBody] Dangkihoc dangkihoc)
        {
            _context.Dangkihoc.Add(dangkihoc);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (DangkihocExists(dangkihoc.Mahv))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetDangkihoc", new { id = dangkihoc.Mahv }, dangkihoc));
        }