Exemple #1
0
        public async Task <IActionResult> PutNhomlop(Nhomlop nhomlop)
        {
            //if (id != nhomlop.Manhom)
            //{
            //    return BadRequest();
            //}

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <Nhomlop> > PostNhomlop([FromBody] Nhomlop nhomlop)
        {
            _context.Nhomlop.Add(nhomlop);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (NhomlopExists(nhomlop.Manhom))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetNhomlop", new { id = nhomlop.Manhom }, nhomlop));
        }