Example #1
0
        public async Task <IActionResult> PutNobler(long id, Nobler nobler)
        {
            if (id != nobler.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Nobler> > PostNobler(Nobler nobler)
        {
            _context.Noblers.Add(nobler);
            await _context.SaveChangesAsync();

            //return CreatedAtAction("GetNobler", new { id = nobler.ID }, nobler);
            return(CreatedAtAction(nameof(GetNobler), new { id = nobler.ID }, nobler));
        }