Esempio n. 1
0
        public async Task <ActionResult <UmRight> > PostUmRight(UmRight umRight)
        {
            _context.UmRights.Add(umRight);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetUmRight", new { id = umRight.Id }, umRight));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutUmRight(int id, UmRight umRight)
        {
            if (id != umRight.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }