Esempio n. 1
0
        public async Task <IActionResult> PutGroupsSetup([FromRoute] int id, [FromBody] GroupsSetup groupsSetup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != groupsSetup.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PostGroupsSetup([FromBody] GroupsSetup groupsSetup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Groups.Add(groupsSetup);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGroupsSetup", new { id = groupsSetup.ID }, groupsSetup));
        }