Example #1
0
        public async Task <IActionResult> PutQUYENHAN([FromRoute] string id, [FromBody] QUYENHAN qUYENHAN)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != qUYENHAN.MAQH)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> PostQUYENHAN([FromBody] QUYENHAN qUYENHAN)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.QUYENHAN.Add(qUYENHAN);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetQUYENHAN", new { id = qUYENHAN.MAQH }, qUYENHAN));
        }