Beispiel #1
0
        public async Task <ActionResult <userrol> > Postuserrol(userrol userrol)
        {
            _context.userrol.Add(userrol);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getuserrol", new { id = userrol.irol }, userrol));
        }
Beispiel #2
0
        public async Task <IActionResult> Putuserrol(int id, userrol userrol)
        {
            if (id != userrol.irol)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }